List of usage examples for org.eclipse.jface.dialogs IDialogSettings getArray
String[] getArray(String key);
From source file:ar.com.fluxit.jqa.wizard.JQAWizard.java
License:Open Source License
private void restoreState() { try {//from w w w . j av a 2 s . c om final IDialogSettings settings = JQAEclipsePlugin.getDefault().getDialogSettings(); final String rulesContextFileString = settings.get("rulesContextFileName"); if (rulesContextFileString != null) { final IPath rulesContextFilePath = Path.fromPortableString(rulesContextFileString); final IFile rulesContextFile = ResourcesPlugin.getWorkspace().getRoot() .getFile(rulesContextFilePath); setRulesContextFile(rulesContextFile); } final String[] targetProjectNames = settings.getArray("targetProjectNames"); if (targetProjectNames != null) { IProject[] targetProjects = new IProject[targetProjectNames.length]; for (int i = 0; i < targetProjects.length; i++) { targetProjects[i] = ResourcesPlugin.getWorkspace().getRoot().getProject(targetProjectNames[i]); } this.targetProjects = targetProjects; } this.newRulesContext = settings.getBoolean("newRulesContext"); } catch (Exception e) { JQAEclipsePlugin.getDefault().getLog().log(new Status(IStatus.ERROR, JQAEclipsePlugin.PLUGIN_ID, IStatus.OK, "Error while restoring state", e)); } }
From source file:at.bestsolution.efxclipse.tooling.fxgraph.ui.wizards.NewFXGraphWizard.java
License:Open Source License
@Override public boolean performFinish() { boolean finish = super.performFinish(); if (finish && getDialogSettings() != null) { IDialogSettings settings = getDialogSettings(); String typeName = getDomainClass().getRootElement().getFullyQualifiedName(); String[] elements = settings.getArray(KEY_LAST_SELECTIONS); if (elements == null) { settings.put(KEY_LAST_SELECTIONS, new String[] { typeName }); } else {/*from ww w.j a v a 2s . c o m*/ List<String> ar = new ArrayList<String>(Arrays.asList(elements)); ar.remove(typeName); ar.add(0, typeName); // If the list gets too long we'll remove the last entry if (ar.size() > MAX_HISTORY_SIZE) { while (ar.size() > MAX_HISTORY_SIZE) { ar.remove(MAX_HISTORY_SIZE); } } settings.put(KEY_LAST_SELECTIONS, ar.toArray(new String[0])); } try { settings.save(SETTINGS_FILE); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return finish; }
From source file:at.bestsolution.efxclipse.tooling.fxml.wizards.NewFXMLWizard.java
License:Open Source License
@Override public boolean performFinish() { boolean finish = super.performFinish(); if (finish && getDialogSettings() != null) { IFile propFile = getPropertiesFile(); if (!propFile.exists()) { InputStream in = getClass().getClassLoader().getResourceAsStream("tpl_fxml-preview.properties"); if (in != null) { try { propFile.create(in, true, null); } catch (CoreException e) { // TODO Auto-generated catch block e.printStackTrace(); }/*from w w w .j a va 2 s .c om*/ try { in.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } IDialogSettings settings = getDialogSettings(); String typeName = getDomainClass().getRootElement().getFullyQualifiedName(); String[] elements = settings.getArray(KEY_LAST_SELECTIONS); if (elements == null) { settings.put(KEY_LAST_SELECTIONS, new String[] { typeName }); } else { List<String> ar = new ArrayList<String>(Arrays.asList(elements)); ar.remove(typeName); ar.add(0, typeName); // If the list gets too long we'll remove the last entry if (ar.size() > MAX_HISTORY_SIZE) { while (ar.size() > MAX_HISTORY_SIZE) { ar.remove(MAX_HISTORY_SIZE); } } settings.put(KEY_LAST_SELECTIONS, ar.toArray(new String[0])); } try { settings.save(SETTINGS_FILE); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return finish; }
From source file:au.gov.ga.earthsci.eclipse.extras.ide.ChooseWorkspaceWithSettingsDialog.java
License:Open Source License
/** * Get the settings for the receiver based on the entries in section. * //from www . ja va 2s .c o m * @param section * @return String[] or <code>null</code> */ private String[] getEnabledSettings(IDialogSettings section) { if (section == null) return null; return section.getArray(ENABLED_TRANSFERS); }
From source file:ca.mcgill.sable.soot.launching.SootConfigFileLauncher.java
License:Open Source License
public void launch(String name, String mainClass) { IDialogSettings settings = SootPlugin.getDefault().getDialogSettings(); setSootCommandList(new SootCommandList()); SootSavedConfiguration ssc = new SootSavedConfiguration(name, settings.getArray(name)); ssc.setEclipseDefs(setEclipseDefs()); getSootCommandList().addSingleOpt(ssc.toRunArray()); Iterator it = getToProcessList().iterator(); while (it.hasNext()) { getSootCommandList().addSingleOpt((String) it.next()); }//from w w w . j a va 2 s .c o m getSootCommandList().printList(); if ((mainClass == null) || (mainClass.length() == 0)) { runSootDirectly(); } else { runSootDirectly(mainClass); } runFinish(); }
From source file:ca.mcgill.sable.soot.launching.SootConfigFromJavaFileLauncher.java
License:Open Source License
public void launch(String name, String mainClass) { IDialogSettings settings = SootPlugin.getDefault().getDialogSettings(); setSootCommandList(new SootCommandList()); SootSavedConfiguration ssc = new SootSavedConfiguration(name, settings.getArray(name)); ssc.setEclipseDefs(setEclipseDefs()); getSootCommandList().addSingleOpt(ssc.toRunArray()); Iterator it = getToProcessList().iterator(); while (it.hasNext()) { getSootCommandList().addSingleOpt((String) it.next()); }//from w w w. ja v a 2 s .c o m if ((mainClass == null) || (mainClass.length() == 0)) { runSootDirectly(); } else { runSootDirectly(mainClass); } runFinish(); }
From source file:ca.mcgill.sable.soot.launching.SootConfigJavaProjectLauncher.java
License:Open Source License
public void launch(String name, String mainClass) { IDialogSettings settings = SootPlugin.getDefault().getDialogSettings(); setSootCommandList(new SootCommandList()); SootSavedConfiguration ssc = new SootSavedConfiguration(name, settings.getArray(name)); ssc.setEclipseDefs(setRunEclipseDefs()); getSootCommandList().addSingleOpt(ssc.toRunArray()); if ((mainClass == null) || (mainClass.length() == 0)) { runSootDirectly();//from w w w . ja v a 2s. co m } else { runSootDirectly(mainClass); } runFinish(); }
From source file:ca.mcgill.sable.soot.launching.SootConfigProjectLauncher.java
License:Open Source License
public void launch(String name, String mainClass) { IDialogSettings settings = SootPlugin.getDefault().getDialogSettings(); setSootCommandList(new SootCommandList()); SootSavedConfiguration ssc = new SootSavedConfiguration(name, settings.getArray(name)); ssc.setEclipseDefs(setEclipseDefs()); getSootCommandList().addSingleOpt(ssc.toRunArray()); if ((mainClass == null) || (mainClass.length() == 0)) { runSootDirectly();//from www . j ava2 s . co m } else { runSootDirectly(mainClass); } runFinish(); }
From source file:ca.mcgill.sable.soot.ui.SootConfigManagerDialog.java
License:Open Source License
private void editPressed() { if (getSelected() == null) return;// w w w.ja va 2 s . co m String result = this.getSelected(); IDialogSettings settings = SootPlugin.getDefault().getDialogSettings(); String[] saveArray = settings.getArray(result); SootSavedConfiguration ssc = new SootSavedConfiguration(result, saveArray); setEditDefs(ssc.toHashMapFromArray()); displayOptions(result, getMainClass(result)); }
From source file:ca.mcgill.sable.soot.ui.SootConfigManagerDialog.java
License:Open Source License
private void renamePressed() { if (getSelected() == null) return;/*w ww.j a v a2s . c o m*/ String result = this.getSelected(); IDialogSettings settings = SootPlugin.getDefault().getDialogSettings(); // gets current number of configurations int config_count = 0; int oldNameCount = 0; try { config_count = settings.getInt(Messages.getString("SootConfigManagerDialog.config_count")); //$NON-NLS-1$ } catch (NumberFormatException e) { } ArrayList currentNames = new ArrayList(); for (int i = 1; i <= config_count; i++) { currentNames.add(settings.get(Messages.getString("SootConfigManagerDialog.soot_run_config") + i)); //$NON-NLS-1$ if (((String) currentNames.get(i - 1)).equals(result)) { oldNameCount = i; } } // sets validator to know about already used names SootConfigNameInputValidator validator = new SootConfigNameInputValidator(); validator.setAlreadyUsed(currentNames); InputDialog nameDialog = new InputDialog(this.getShell(), Messages.getString("SootConfigManagerDialog.Rename_Saved_Configuration"), //$NON-NLS-1$ Messages.getString("SootConfigManagerDialog.Enter_new_name"), "", validator); //$NON-NLS-1$ //$NON-NLS-2$ nameDialog.open(); if (nameDialog.getReturnCode() == Dialog.OK) { settings.put(Messages.getString("SootConfigManagerDialog.soot_run_config") + oldNameCount, //$NON-NLS-1$ nameDialog.getValue()); settings.put(nameDialog.getValue(), settings.getArray(result)); getTreeRoot().renameChild(result, nameDialog.getValue()); saveMainClass(nameDialog.getValue(), settings.get(result + "_mainClass")); } refreshTree(); }