import java.util.Set;\r
\r
import org.eclipse.core.runtime.FileLocator;\r
-import org.eclipse.core.runtime.Platform;\r
import org.eclipse.jface.dialogs.MessageDialog;\r
import org.eclipse.jface.layout.GridDataFactory;\r
import org.eclipse.jface.layout.GridLayoutFactory;\r
import org.eclipse.swt.widgets.Control;\r
import org.eclipse.swt.widgets.Display;\r
import org.eclipse.swt.widgets.Shell;\r
+import org.osgi.framework.Bundle;\r
import org.simantics.PlatformException;\r
import org.simantics.Simantics;\r
import org.simantics.databoard.Bindings;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.ltk.ISource;\r
import org.simantics.ltk.Problem;\r
+import org.simantics.modeling.ui.Activator;\r
import org.simantics.utils.datastructures.Pair;\r
\r
/**\r
final Collection<ISource> sources = new ArrayList<ISource>();\r
Collection<TransferableGraph1> dependencies = new ArrayList<TransferableGraph1>();\r
\r
- File L0GraphFile = url2file(FileLocator.resolve(Platform.getBundle("org.simantics.layer0").getEntry("/graph.tg")), "L0_graph.tg");\r
- File L0XGraphFile = url2file(FileLocator.resolve(Platform.getBundle("org.simantics.layer0x.ontology").getEntry("/graph.tg")), "L0X_graph.tg");\r
- File DiagramGraphFile = url2file(FileLocator.resolve(Platform.getBundle("org.simantics.diagram.ontology").getEntry("/graph.tg")), "DIA_graph.tg");\r
- File G2DGraphFile = url2file(FileLocator.resolve(Platform.getBundle("org.simantics.g2d.ontology").getEntry("/graph.tg")), "G2D_graph.tg");\r
- File StructuralGraphFile = url2file(FileLocator.resolve(Platform.getBundle("org.simantics.structural.ontology").getEntry("/graph.tg")), "ST_graph.tg");\r
- File ModelingGraphFile = url2file(FileLocator.resolve(Platform.getBundle("org.simantics.modeling.ontology").getEntry("/graph.tg")), "MOD_graph.tg");\r
- File SimulationGraphFile = url2file(FileLocator.resolve(Platform.getBundle("org.simantics.simulation.ontology").getEntry("/graph.tg")), "SIMU_graph.tg");\r
- File DocumentGraphFile = url2file(FileLocator.resolve(Platform.getBundle("org.simantics.document.ontology").getEntry("/graph.tg")), "DOC_graph.tg");\r
- File SpreadsheetGraphFile = url2file(FileLocator.resolve(Platform.getBundle("org.simantics.spreadsheet.ontology").getEntry("/graph.tg")), "SHEET_graph.tg");\r
- File ProjectGraphFile = url2file(FileLocator.resolve(Platform.getBundle("org.simantics.project.ontology").getEntry("/graph.tg")), "PROJ_graph.tg");\r
- File SelectionViewGraphFile = url2file(FileLocator.resolve(Platform.getBundle("org.simantics.selectionview.ontology").getEntry("/graph.tg")), "SEL_graph.tg");\r
- \r
- dependencies.add(GraphCompiler.read(L0GraphFile));\r
- dependencies.add(GraphCompiler.read(L0XGraphFile));\r
- dependencies.add(GraphCompiler.read(DiagramGraphFile));\r
- dependencies.add(GraphCompiler.read(G2DGraphFile));\r
- dependencies.add(GraphCompiler.read(StructuralGraphFile));\r
- dependencies.add(GraphCompiler.read(ModelingGraphFile));\r
- dependencies.add(GraphCompiler.read(SimulationGraphFile));\r
- dependencies.add(GraphCompiler.read(DocumentGraphFile));\r
- dependencies.add(GraphCompiler.read(SpreadsheetGraphFile));\r
- dependencies.add(GraphCompiler.read(ProjectGraphFile));\r
- dependencies.add(GraphCompiler.read(SelectionViewGraphFile));\r
+ for(Bundle b : Activator.getContext().getBundles()) {\r
+ URL tg = b.getEntry("/graph.tg");\r
+ if(tg == null) continue;\r
+ File f = url2file(FileLocator.resolve(tg), b.getSymbolicName());\r
+ dependencies.add(GraphCompiler.read(f));\r
+ }\r
\r
final TransferableGraph1 thisOntology = Simantics.sync(new UniqueRead<TransferableGraph1>() {\r
\r
\r
Layer0 L0 = Layer0.getInstance(graph);\r
Resource parent = graph.getSingleObject(r, L0.PartOf);\r
- String name = graph.getRelatedValue(r, L0.HasName, Bindings.STRING);\r
\r
CopyHandler ch = new DefaultCopyHandler(r) {\r
\r
\r
});\r
\r
-\r
- \r
final StringBuilder errorStringBuilder = new StringBuilder();\r
GraphCompilerPreferences prefs = new GraphCompilerPreferences();\r
prefs.validate = true;\r
\r
final DefaultPasteImportAdvisor advisor = new DefaultPasteImportAdvisor(r);\r
\r
- // final ImportAdvisor advisor = new ImportAdvisor(r, modelName);\r
DefaultPasteHandler.defaultExecute(result.getGraph(), r, advisor);\r
\r
Simantics.sync(new WriteRequest() {\r
\r
}\r
\r
- \r
-\r
- \r
} catch (Exception e) {\r
Logger.defaultLogError(e);\r
}\r