List of usage examples for org.eclipse.jface.dialogs IDialogSettings put
void put(String key, boolean value);
From source file:ar.com.fluxit.jqa.wizard.JQAWizard.java
License:Open Source License
private void saveState() { final IDialogSettings settings = JQAEclipsePlugin.getDefault().getDialogSettings(); settings.put("rulesContextFileName", getRulesContextFile().getFullPath().toPortableString()); final int targetProjectslength = getTargetProjects().length; String[] targetProjectNames = new String[targetProjectslength]; for (int i = 0; i < targetProjectslength; i++) { targetProjectNames[i] = getTargetProjects()[i].getName(); }/*from w ww . j a v a 2s. c o m*/ settings.put("targetProjectNames", targetProjectNames); settings.put("newRulesContext", isNewRulesContext()); }
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 {/* w ww . j a v a 2s . co 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(); }/* w w w. j a v a 2 s . com*/ 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:at.bestsolution.efxclipse.tooling.pde.e4.project.PluginContentPage.java
License:Open Source License
/** * Saves the current state of widgets of interest in the dialog settings for the wizard * @param settings/* w w w .jav a2 s . co m*/ */ public void saveSettings(IDialogSettings settings) { settings.put(S_GENERATE_ACTIVATOR, !fGenerateActivator.getSelection()); if (fUIPlugin.isEnabled()) { settings.put(S_UI_PLUGIN, !fUIPlugin.getSelection()); } if (fApiAnalysisButton.isEnabled()) { settings.put(S_API_ANALYSIS, fApiAnalysisButton.getSelection()); } settings.put(S_RCP_PLUGIN, true); }
From source file:at.kolli.automation.client.LayoutLoader.java
License:Open Source License
/** * run routine to load files from server * and generate layout files/*from w w w . ja v a 2s . c om*/ * * @serial * @see * @override * @author Alexander Kolli * @version 1.00.00, 23.12.2007 * @since JDK 1.6 */ public void run() { Boolean bConnected = false; short type = 0; String user = ""; String pwd = ""; String olduser, oldpwd; String error = ""; HashMap<String, Date> folder = new HashMap<String, Date>(); DialogThread dialog = DialogThread.instance(); MsgTranslator trans = MsgTranslator.instance(); MsgClientConnector client; String loginname; IDialogSettings login = TreeNodes.m_Settings.getSection("loginDialog"); setName("LayoutLoader"); client = MsgClientConnector.instance(m_sHost, m_nPort); while (!stopping()) { try { while (getType() == WAIT) { stateLock.lock(); try { // wait until no new content should be loading newStateCondition.await(); } catch (InterruptedException ex) { System.out.println( "newStateCodition get's InterruptedException, so wait for 100 milliseconds"); try { sleep(100); } catch (InterruptedException iex) { System.out.println("cannot sleep 10 milliseconds for wating on LayoutLoader-thread"); iex.printStackTrace(); } } finally { stateLock.unlock(); } if (stopping()) return; } while (!dialog.isOpen() && getType() != WAIT) { try { sleep(100); } catch (InterruptedException ex) { } if (stopping()) return; } MsgTranslator.instance().clearErrorPool(); type = getType(); if (type == DISPOSE) { dialog.setSelection(0); dialog.setSteps(1); if (HtmTags.showDisposeClient) { if (m_aTreeNodes != null && !m_aTreeNodes.isEmpty()) { TreeNodes.m_nNodeCount = 0; for (TreeNodes node : m_aTreeNodes) TreeNodes.m_nNodeCount += node.count(); dialog.setSteps(TreeNodes.m_nNodeCount + 1); for (TreeNodes node : m_aTreeNodes) node.dispose(/*subnodes*/true); } } dialog.show(trans.translate("closeConnections")); //client.closeConnection(); dialog.nextStep(); dialog.close(); return; } if (type == WAIT) continue; bConnected = false; olduser = user = TreeNodes.m_sUser; oldpwd = pwd = TreeNodes.m_sPwd; if (type != REFRESH && type != BROKEN && login != null) { loginname = null; if (type == LayoutLoader.UPDATE) loginname = login.get("lastchangename"); if (loginname == null) loginname = login.get("lastloginname"); user = loginname; } while (!bConnected) { if (type == CREATE || type == UPDATE) { if (dialog.verifyUser(user, pwd, error).equals(states.CANCEL)) break; user = TreeNodes.m_sUser; } dialog.needProgressBar(); dialog.show(trans.translate("dialogConnectionTitle"), trans.translate("dialogConnectionSearchMsg")); if (type != REFRESH) { if (type == CREATE || type == BROKEN) { client.openNewConnection(TreeNodes.m_sUser, TreeNodes.m_sPwd); } else client.changeUser(TreeNodes.m_sUser, TreeNodes.m_sPwd, /*bthrow*/true); if (!dialog.isOpen()) stopThread(); if (stopping()) break; type = getType(); if (client.hasError()) { Toolkit oKit = Toolkit.getDefaultToolkit(); oKit.beep(); error = client.getErrorCode(); dialog.show(client.getErrorMessage()); client.closeConnection(); } else bConnected = true; } else bConnected = true; } if (dialog.dialogState().equals(states.RUN)) { user = TreeNodes.m_sUser; if (login == null) { login = new DialogSettings("loginDialog"); login.put("lastloginname", user); login.put("loginnames", user); TreeNodes.m_Settings.addSection(login); } else { Boolean exists = false; String names = login.get("loginnames"); String[] snames = names.split(":"); for (String name : snames) { if (name.equals(user)) { exists = true; break; } } if (!exists) login.put("loginnames", names + ":" + user); if (type == CREATE) login.put("lastloginname", user); else if (type == UPDATE) login.put("lastchangename", user); } folder = client.getDirectory("." + TreeNodes.m_sLayoutStyle, /*bthrow*/true); if (!client.hasError()) { if (HtmTags.debug) { ArrayList<String> folderKeys = new ArrayList<String>(folder.keySet()); Collections.sort(folderKeys); System.out.println("found follow Files on server:"); for (String str : folderKeys) System.out.println(str); } } else { System.out.println(client.getErrorMessage()); return; } TreeNodes.m_hmDirectory = folder; dialog.show(trans.translate("dialogLoadContent")); initializeMainWidget(TreeNodes.m_hmDirectory); if (dialog.dialogState().equals(DialogThread.states.CANCEL)) return; if (dialog.dialogState().equals(states.RUN)) { //System.out.println("Close Dialog Box"); dialog.close(); } else // change user back; client.changeUser(olduser, oldpwd, /*bthrow*/true); } /** * create all not currently visible sides * in background with lower or higher priority */ if (HtmTags.useBackgroundLoadingPriority > 0) { Thread.currentThread().setPriority(HtmTags.useBackgroundLoadingPriority); if (createSidesOnBackground()) { setState(WAIT); type = WAIT; } Thread.currentThread().setPriority(Thread.NORM_PRIORITY); if (HtmTags.debug) System.out.println("reading of sides on background was finished"); } setState(WAIT); } catch (IOException ex) { if (HtmTags.debug) { System.out.println("-----------------------------------------------"); System.out.println(client.getErrorMessage()); ex.printStackTrace(); System.out.println("-----------------------------------------------"); } client.closeConnection(); setState(BROKEN); type = WAIT; } } if (HtmTags.debug) System.out.println("Ending of thread '" + getName() + "'"); }
From source file:at.kolli.automation.client.PortServerClient.java
License:Open Source License
/** * starting hole application//w w w. ja v a2 s .c o m * * @param host host-name or IP-address where the server running * @param port port-number on which the server running on host * @param lang language in which the messages and menu should displayed * @param maincolor main color set from client.ini * @author Alexander Kolli * @version 1.00.00, 02.12.2007 * @since JDK 1.6 */ protected void startApp(String host, int port, String lang, String maincolor) { BooleanHolder oCreated = new BooleanHolder(); int mainStyle = SWT.NONE; int debugCount = 0; DialogThread dialog; WidgetChecker checker; MsgClientConnector client; LayoutLoader loader; MsgTranslator trans = MsgTranslator.init(lang); FontObject baseFont = new FontObject(); if (!trans.getError().equals("NONE")) { System.out.println(trans.getError()); System.exit(1); } if (HtmTags.notitle) mainStyle |= SWT.NO_TRIM; else mainStyle |= SWT.TITLE | SWT.MIN | SWT.CLOSE | SWT.RESIZE; display = new Display(); toplevelShell = new Shell(display, mainStyle); dialog = DialogThread.instance(toplevelShell); LayoutLoader.init(toplevelShell, host, port); if (maincolor == null || maincolor.trim().equals("")) { HtmTags.systemColor = baseFont.getColor(display, "BACKGROUND", oCreated, "client.ini_maincolor"); } else HtmTags.systemColor = baseFont.getColor(display, maincolor, oCreated, "client.ini_maincolor"); toplevelShell.setBackground(HtmTags.systemColor); if (HtmTags.fullscreen) toplevelShell.setMaximized(true); setDisplayImages(display, toplevelShell); dialog.needProgressBar(); if (TreeNodes.m_sUser.equals("") || TreeNodes.m_sPwd.equals("")) { dialog.show(trans.translate("dialogConnectionTitle"), trans.translate("dialogUserVerification")); dialog.needUserVerificationFields(); } loader = LayoutLoader.instance(); loader.setState(LayoutLoader.CREATE); if (dialog.produceDialog(LayoutLoader.CREATE).equals(DialogThread.states.CANCEL)) { loader.stopThread(); while (loader.isAlive()) { try { Thread.sleep(100); } catch (InterruptedException ex) { ex.printStackTrace(); } } return; } final boolean bCreated = oCreated.value; toplevelShell.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent ev) { int[] sashWeight; Point location, size; IDialogSettings login = TreeNodes.m_Settings.getSection(TreeNodes.m_sLayoutStyle); LayoutLoader loader = LayoutLoader.instance(); location = toplevelShell.getLocation(); size = toplevelShell.getSize(); if (!HtmTags.notree) { sashWeight = loader.m_shellForm.getWeights(); login.put("sashwidth", sashWeight[0]); login.put("sashheight", sashWeight[1]); } login.put("xLocation", location.x); login.put("yLocation", location.y); login.put("mainwidth", size.x); login.put("mainheight", size.y); TreeNodes.saveSettings(); if (bCreated) HtmTags.systemColor.dispose(); loader.disposeClientEnding(); } }); if (HtmTags.debug) System.out.println("open top level shell"); toplevelShell.open(); while (!toplevelShell.isDisposed()) { if (HtmTags.dispatchShell) { System.out.println(debugCount + " dispatch for toplevelShell"); } if (!display.readAndDispatch()) { if (HtmTags.dispatchShell) { System.out.println(debugCount + " sleep for no dispatch"); } display.sleep(); } if (!loader.isAlive()) toplevelShell.dispose(); if (HtmTags.dispatchShell) { ++debugCount; if (debugCount == Integer.MAX_VALUE) debugCount = 0; } } if (HtmTags.dispatchShell) { System.out.println("toplevelShell was disposed"); } client = MsgClientConnector.instance(); checker = WidgetChecker.instance(); try { //dialog.stopping(); checker.stopping(); client.closeConnection(); if (checker.isAlive()) checker.join(); loader.stopThread(); } catch (InterruptedException ex) { System.out.println("Interrupted exception by ending with join"); ex.printStackTrace(); } //display.dispose(); /*if(m_aImgBuffer != null) { for (Image sysImg : m_aImgBuffer) { sysImg.dispose(); } }*/ System.out.println("ppi-client was ending"); }
From source file:au.gov.ga.earthsci.eclipse.extras.ide.ChooseWorkspaceWithSettingsDialog.java
License:Open Source License
/** * Save the ids of the selected elements. * // w w w.j av a 2 s . c o m * @param selectionIDs */ private void saveSettings(String[] selectionIDs) { IDialogSettings settings = Activator.getDefault().getDialogSettings().getSection(WORKBENCH_SETTINGS); if (settings == null) settings = Activator.getDefault().getDialogSettings().addNewSection(WORKBENCH_SETTINGS); settings.put(ENABLED_TRANSFERS, selectionIDs); }
From source file:ca.edchipman.silverstripepdt.dialogs.FilteredTypesSelectionDialog.java
License:Open Source License
protected void storeDialog(IDialogSettings settings) { super.storeDialog(settings); if (fFilterActionGroup != null) { XMLMemento memento = XMLMemento.createWriteRoot("workingSet"); //$NON-NLS-1$ fFilterActionGroup.saveState(memento); fFilterActionGroup.dispose();// w w w . j a v a2 s . c o m StringWriter writer = new StringWriter(); try { memento.save(writer); settings.put(WORKINGS_SET_SETTINGS, writer.getBuffer().toString()); } catch (IOException e) { // don't do anything. Simply don't store the settings DLTKUIPlugin.log(e); } } }
From source file:ca.mcgill.sable.soot.launching.SavedConfigManager.java
License:Open Source License
private void remove(String name) { IDialogSettings settings = SootPlugin.getDefault().getDialogSettings(); int count = 0; try {/*from ww w .ja v a 2s .c o m*/ count = settings.getInt("config_count"); } catch (NumberFormatException e) { } String[] pointers = new String[count]; for (int i = 1; i <= count; i++) { pointers[i - 1] = settings.get("soot_run_config_" + i); } int i = 1; int j = 0; while (j < count) { if (!pointers[j].equals(name)) { settings.put("soot_run_config_" + i, pointers[j]); i++; } j++; } settings.put("soot_run_config_" + count, (String) null); count--; if (count < 0) { count = 0; } settings.put("config_count", count); settings.put(name, (String) null); }
From source file:ca.mcgill.sable.soot.launching.SavedConfigManager.java
License:Open Source License
private void update(String name, ArrayList val) { String[] temp = new String[val.size()]; val.toArray(temp); IDialogSettings settings = SootPlugin.getDefault().getDialogSettings(); settings.put(name, temp); }