/** * From diagram URI get Apdl URI. set it to private field. * * @param diagramFileURI */ public void setAPDLFileName(URI diagramFileURI) { IPreferenceStore store = BpwmeDiagramEditorPlugin.getInstance().getPreferenceStore(); String dot = "\\."; String[] names = diagramFileURI.lastSegment().split(dot); if (names.length == 2) { apdlURI = diagramFileURI.trimFileExtension().appendFileExtension("xml"); // apdlURI = // URI.createFileURI(store.getString(PreferenceConstants.P_APDL_DIR)+names[0]+".xml"); store.setValue(PreferenceConstants.P_APDL_FILE, apdlURI.toFileString()); File f = new File(apdlURI.toFileString()); if (!f.exists()) { try { f.createNewFile(); } catch (IOException e) { e.printStackTrace(); } } IPath location = new Path(f.getAbsolutePath()); PathEditorInput input = new PathEditorInput(location); SimpleEditor.setEditorInput(input); } else { System.err.println("Error in MainControl.getFileName"); } }
public MainControl() throws Exception { // create apdl file directory if it's not exist IPreferenceStore store = BpwmeDiagramEditorPlugin.getInstance().getPreferenceStore(); // File directory = new File(store.getString(PreferenceConstants.P_APDL_DIR)); // if(!directory.exists()) { // directory.mkdirs(); // } String apdlFileString = store.getString(PreferenceConstants.P_APDL_FILE); if (!apdlFileString.equals("")) { // this is a restart fa = FileAction.Restart; setAPDLURI(apdlFileString); } // initialization for some objects objectFactory = new ObjectFactory(); // candidateLRList = new ArrayList<ApdlDataField>(); objectMap = new HashMap<Integer, Object>(); // ebprocMap = new HashMap<String, EventType>(); extraLLRPProperty = new Vector<ExtraProperty>(); extraRPProperty = new Vector<ExtraProperty>(); extraHALProperty = new Vector<ExtraProperty>(); extraLLRPProperty.add(new ExtraProperty("ConnectionPointAddress", ExtraProperty.LLRP_TYPE)); extraLLRPProperty.add(new ExtraProperty("ConnectionPointPort", ExtraProperty.LLRP_TYPE)); extraLLRPProperty.add(new ExtraProperty("PhysicalReaderSource", ExtraProperty.LLRP_TYPE)); extraLLRPProperty.add(new ExtraProperty("RoSpecID", ExtraProperty.LLRP_TYPE)); extraRPProperty.add(new ExtraProperty("ConnectionPointAddress", ExtraProperty.RP_TYPE)); extraRPProperty.add(new ExtraProperty("ConnectionPointPort", ExtraProperty.RP_TYPE)); extraRPProperty.add(new ExtraProperty("PhysicalReaderSource", ExtraProperty.RP_TYPE)); extraRPProperty.add(new ExtraProperty("RoSpecID", ExtraProperty.RP_TYPE)); }
/** * Set the apdl uri with the given file name * * @param apdlFileName */ public void setAPDLURI(String apdlFileName) { apdlURI = URI.createFileURI(apdlFileName); IPreferenceStore store = BpwmeDiagramEditorPlugin.getInstance().getPreferenceStore(); store.setValue(PreferenceConstants.P_APDL_FILE, apdlURI.toFileString()); }