-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bundle uses immediate service to init workspace to default location, before prompt is even shown. See eclipse-equinox/equinox.bundles#21
- Loading branch information
1 parent
1cd5e17
commit 7e50e68
Showing
4 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Manifest-Version: 1.0 | ||
Bundle-ManifestVersion: 2 | ||
Bundle-Name: BadWorkspaceInit | ||
Bundle-SymbolicName: BadWorkspaceInit | ||
Bundle-Version: 1.0.0.qualifier | ||
Automatic-Module-Name: BadWorkspaceInit | ||
Bundle-RequiredExecutionEnvironment: JavaSE-11 | ||
Require-Bundle: org.eclipse.core.resources, | ||
org.eclipse.core.runtime | ||
Service-Component: OSGI-INF/startupComponent.xml | ||
Bundle-ActivationPolicy: lazy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="start" immediate="true" name="projectLocker"> | ||
<implementation class="de.loskutov.workspace.StartupComponent"/> | ||
</scr:component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
source.. = src/ | ||
output.. = bin/ | ||
bin.includes = META-INF/,\ | ||
.,\ | ||
OSGI-INF/ |
35 changes: 35 additions & 0 deletions
35
BadWorkspaceInit/src/de/loskutov/workspace/StartupComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package de.loskutov.workspace; | ||
|
||
import org.eclipse.core.resources.IWorkspace; | ||
import org.eclipse.core.resources.ResourcesPlugin; | ||
import org.eclipse.core.runtime.IProgressMonitor; | ||
import org.eclipse.core.runtime.IStatus; | ||
import org.eclipse.core.runtime.Platform; | ||
import org.eclipse.core.runtime.Status; | ||
import org.eclipse.core.runtime.jobs.Job; | ||
|
||
public class StartupComponent { | ||
|
||
public StartupComponent() { | ||
super(); | ||
} | ||
|
||
public void start() { | ||
Job job = new Job("Bad workspace init") { | ||
@Override | ||
protected IStatus run(IProgressMonitor monitor) { | ||
// IContainer c = null; | ||
// String encoding = ResourcesPlugin.getEncoding(); | ||
IWorkspace workspace = ResourcesPlugin.getWorkspace(); | ||
if(workspace == null) { | ||
return Status.OK_STATUS; | ||
} | ||
String message = "Workspace is there: " + workspace; | ||
System.err.println(message); | ||
IStatus error = Status.error(message, new Exception("Using default workspace!!!")); | ||
return error; | ||
} | ||
}; | ||
job.schedule(); | ||
} | ||
} |