Revision ca4910f7
Added by Patrick Plitzner over 5 years ago
eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/ModelResourceHandler.java | ||
---|---|---|
21 | 21 |
import javax.inject.Named; |
22 | 22 |
|
23 | 23 |
import org.eclipse.core.internal.runtime.PlatformURLPluginConnection; |
24 |
import org.eclipse.core.runtime.Platform; |
|
25 |
import org.eclipse.core.runtime.URIUtil; |
|
26 | 24 |
import org.eclipse.e4.core.contexts.ContextInjectionFactory; |
27 | 25 |
import org.eclipse.e4.core.contexts.IEclipseContext; |
28 | 26 |
import org.eclipse.e4.core.services.log.Logger; |
... | ... | |
50 | 48 |
import org.eclipse.emf.ecore.util.EcoreUtil; |
51 | 49 |
import org.osgi.framework.Bundle; |
52 | 50 |
|
51 |
import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility; |
|
52 |
|
|
53 | 53 |
/** |
54 | 54 |
* This is a copy of |
55 | 55 |
* {@link org.eclipse.e4.ui.internal.workbench.ResourceHandler}. The copy is |
... | ... | |
245 | 245 |
} |
246 | 246 |
|
247 | 247 |
private File getWorkbenchSaveLocation() { |
248 |
File workbenchData = new File(getBaseLocation(), WORKBENCH_XMI); //$NON-NLS-1$ |
|
248 |
File workbenchData = new File(WorkbenchUtility.getBaseLocation(), WORKBENCH_XMI); //$NON-NLS-1$
|
|
249 | 249 |
return workbenchData; |
250 | 250 |
} |
251 | 251 |
|
252 |
private File getBaseLocation() { |
|
253 |
File baseLocation; |
|
254 |
try { |
|
255 |
baseLocation = new File(URIUtil.toURI(Platform.getInstallLocation().getURL())); |
|
256 |
} catch (Exception e) { |
|
257 |
throw new RuntimeException(e); |
|
258 |
} |
|
259 |
baseLocation = new File(baseLocation, "configuration"); //$NON-NLS-1$ |
|
260 |
return baseLocation; |
|
261 |
} |
|
262 |
|
|
263 | 252 |
// Ensures that even models with error are loaded! |
264 | 253 |
private Resource loadResource(URI uri) { |
265 | 254 |
Resource resource; |
eu.etaxonomy.taxeditor.workbench/src/main/java/eu/etaxonomy/taxeditor/workbench/WorkbenchUtility.java | ||
---|---|---|
8 | 8 |
*/ |
9 | 9 |
package eu.etaxonomy.taxeditor.workbench; |
10 | 10 |
|
11 |
import java.io.File; |
|
11 | 12 |
import java.util.List; |
12 | 13 |
|
14 |
import org.eclipse.core.runtime.Platform; |
|
15 |
import org.eclipse.core.runtime.URIUtil; |
|
13 | 16 |
import org.eclipse.e4.ui.model.application.MApplication; |
14 | 17 |
import org.eclipse.e4.ui.model.application.ui.advanced.MArea; |
15 | 18 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
... | ... | |
45 | 48 |
return object; |
46 | 49 |
} |
47 | 50 |
|
51 |
public static File getBaseLocation() { |
|
52 |
File baseLocation; |
|
53 |
try { |
|
54 |
baseLocation = new File(URIUtil.toURI(Platform.getInstallLocation().getURL())); |
|
55 |
} catch (Exception e) { |
|
56 |
throw new RuntimeException(e); |
|
57 |
} |
|
58 |
baseLocation = new File(baseLocation, "configuration"); //$NON-NLS-1$ |
|
59 |
return baseLocation; |
|
60 |
} |
|
61 |
|
|
48 | 62 |
public static Object findSavablePart(ISelectionElementEditingPart part){ |
49 | 63 |
Object selectionProvidingPart = getE4WrappedPart(part.getSelectionProvidingPart()); |
50 | 64 |
if(selectionProvidingPart instanceof ISelectionElementEditingPart){ |
Also available in: Unified diff
Move getBaseLocation() utility method to WorkbenchUtility