List of usage examples for org.eclipse.jface.preference IPreferenceStore getString
String getString(String name);
From source file:com.generalrobotix.ui.GrxPluginManager.java
License:Open Source License
public void loadInitialProject() { IPreferenceStore store = Activator.getDefault().getPreferenceStore(); String initProjectFile = store.getString(PreferenceConstants.INITIALPROJECT); File f = new File(initProjectFile); if (f.exists() && f.isFile()) currentProject_.load(f);//from w w w .ja va2s. c o m }
From source file:com.generalrobotix.ui.item.GrxProjectItem.java
License:Open Source License
@SuppressWarnings("deprecation") private Element storePerspectiveConf(Element element) { IWorkbenchPage page = null;//from w w w. j a v a2 s . c o m IWorkbench workbench = PlatformUI.getWorkbench(); if (workbench != null) { IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); if (window != null) { page = window.getActivePage(); if (!page.getPerspective().getId().contains(GrxUIPerspectiveFactory.ID)) { return null; } } } IPerspectiveRegistry perspectiveRegistry = workbench.getPerspectiveRegistry(); IPerspectiveDescriptor orgPd = perspectiveRegistry.findPerspectiveWithId(GrxUIPerspectiveFactory.ID); IPerspectiveDescriptor tempPd = perspectiveRegistry .findPerspectiveWithId(GrxUIPerspectiveFactory.ID + ".project"); if (tempPd != null) perspectiveRegistry.deletePerspective(tempPd); tempPd = perspectiveRegistry.clonePerspective(GrxUIPerspectiveFactory.ID + ".project", getName(), orgPd); page.savePerspectiveAs(tempPd); page.setPerspective(orgPd); page.setPerspective(tempPd); IPreferenceStore store = workbench.getPreferenceStore(); String confString = store.getString(GrxUIPerspectiveFactory.ID + ".project" + "_persp"); Document doc = null; try { doc = builder_.parse(new InputSource(new StringReader(confString))); Element confElement = doc.getDocumentElement(); Node elementCopy = doc_.importNode(confElement, true); element.appendChild(elementCopy); return (Element) elementCopy; } catch (SAXException e1) { e1.printStackTrace(); } catch (IOException e1) { e1.printStackTrace(); } return null; }
From source file:com.generalrobotix.ui.util.GrxServerManager.java
License:Open Source License
private void getNameServerInfoFromPerferenceStore() { IPreferenceStore store = Activator.getDefault().getPreferenceStore(); nameServerInfo.id = PreferenceConstants.NAMESERVER; String _dir = store.getString(PreferenceConstants.PROCESS + "." + PreferenceConstants.NAMESERVER + "." + PreferenceConstants.LOGGIR); NAME_SERVER_LOG_DIR_ = GrxXmlUtil.expandEnvVal(_dir).trim(); if (!NAME_SERVER_LOG_DIR_.isEmpty()) { String localStr = NAME_SERVER_LOG_DIR_.replaceFirst("^\"", ""); File logDir = new File(localStr.replaceFirst("\"$", "")); if (!logDir.exists()) { logDir.mkdirs();//from ww w . j a v a 2 s .com } } NAME_SERVER_PORT_ = store.getInt(PreferenceConstants.PROCESS + "." + PreferenceConstants.NAMESERVER + "." + PreferenceConstants.PORT); if (NAME_SERVER_PORT_ == 0) NAME_SERVER_PORT_ = store.getDefaultInt(PreferenceConstants.PROCESS + "." + PreferenceConstants.NAMESERVER + "." + PreferenceConstants.PORT); NAME_SERVER_HOST_ = store.getString(PreferenceConstants.PROCESS + "." + PreferenceConstants.NAMESERVER + "." + PreferenceConstants.HOST); if (NAME_SERVER_HOST_.equals("")) NAME_SERVER_HOST_ = store.getDefaultString(PreferenceConstants.PROCESS + "." + PreferenceConstants.NAMESERVER + "." + PreferenceConstants.HOST); nameServerInfo.args = generateNameServerArgs(); String s = store.getString( PreferenceConstants.PROCESS + "." + PreferenceConstants.NAMESERVER + "." + PreferenceConstants.COM); // SERVER_DIR?, Path???????, AbsolutePath// String ss = comToAbsolutePath(s); if (ss != null) nameServerInfo.com.add(ss); nameServerInfo.com.add(s); s = store.getString(PreferenceConstants.PROCESS + "." + PreferenceConstants.NAMESERVER + "." + PreferenceConstants.COM + 0); if (!s.equals("")) nameServerInfo.com.add(s); nameServerInfo.autoStart = true; nameServerInfo.waitCount = store.getInt(PreferenceConstants.PROCESS + "." + PreferenceConstants.NAMESERVER + "." + PreferenceConstants.WAITCOUNT); nameServerInfo.dir = store.getString( PreferenceConstants.PROCESS + "." + PreferenceConstants.NAMESERVER + "." + PreferenceConstants.DIR) .trim(); nameServerInfo.isCorbaServer = false; nameServerInfo.hasShutdown = store.getBoolean(PreferenceConstants.PROCESS + "." + PreferenceConstants.NAMESERVER + "." + PreferenceConstants.HASSHUTDOWN); nameServerInfo.doKillall = false; nameServerInfo.autoStop = true; }
From source file:com.generalrobotix.ui.util.GrxServerManager.java
License:Open Source License
private void getServerInfoFromPerferenceStore() { IPreferenceStore store = Activator.getDefault().getPreferenceStore(); String idList = store.getString(PreferenceConstants.PROCESS + "." + PreferenceConstants.ID); String[] id = idList.split(PreferenceConstants.SEPARATOR, -1); String dirList = store.getString(PreferenceConstants.PROCESS + "." + PreferenceConstants.DIR); String[] dir = parse(dirList); String waitCountList = store.getString(PreferenceConstants.PROCESS + "." + PreferenceConstants.WAITCOUNT); String[] waitCount = waitCountList.split(PreferenceConstants.SEPARATOR, -1); String comList = store.getString(PreferenceConstants.PROCESS + "." + PreferenceConstants.COM); String[] com = parse(comList); String argsList = store.getString(PreferenceConstants.PROCESS + "." + PreferenceConstants.ARGS); String[] args = parse(argsList); String autoStartList = store.getString(PreferenceConstants.PROCESS + "." + PreferenceConstants.AUTOSTART); String[] autoStart = autoStartList.split(PreferenceConstants.SEPARATOR, -1); String useORBList = store.getString(PreferenceConstants.PROCESS + "." + PreferenceConstants.USEORB); String[] useORB = useORBList.split(PreferenceConstants.SEPARATOR, -1); String hasShutDownList = store .getString(PreferenceConstants.PROCESS + "." + PreferenceConstants.HASSHUTDOWN); String[] hasShutDown = hasShutDownList.split(PreferenceConstants.SEPARATOR, -1); for (int i = 1; i < id.length; i++) { ProcessInfo processInfo = new ProcessInfo(); processInfo.id = id[i];/*from w w w . ja va 2 s. c o m*/ String s = null; if (i < com.length && !com[i].equals("")) s = com[i].trim(); else s = com[0].trim(); // AbsolutePath, SERVER_DIR?, Path???????// if ((new File(s)).isAbsolute()) processInfo.com.add(s); else { String ss = comToAbsolutePath(s); if (ss != null) { processInfo.com.add(ss); processInfo.editComIndex = 1; } processInfo.com.add(s); } if (i < args.length && !args[i].equals("")) processInfo.args = args[i].trim(); else processInfo.args = args[0].trim(); if (i < autoStart.length && !autoStart[i].equals("")) processInfo.autoStart = autoStart[i].equals("true") ? true : false; else processInfo.autoStart = autoStart[0].equals("true") ? true : false; if (i < useORB.length && !useORB[i].equals("")) processInfo.useORB = useORB[i].equals("true") ? true : false; else processInfo.useORB = useORB[0].equals("true") ? true : false; if (i < hasShutDown.length && !hasShutDown[i].equals("")) processInfo.hasShutdown = hasShutDown[i].equals("true") ? true : false; else processInfo.hasShutdown = hasShutDown[0].equals("true") ? true : false; if (i < waitCount.length && !waitCount[i].equals("")) processInfo.waitCount = Integer.parseInt(waitCount[i]); else processInfo.waitCount = Integer.parseInt(waitCount[0]); if (i < dir.length && !dir[i].equals("")) processInfo.dir = dir[i].trim(); else processInfo.dir = dir[0].trim(); processInfo.isCorbaServer = true; processInfo.doKillall = false; processInfo.autoStop = true; vecServerInfo.add(processInfo); } serverInfoDefaultDir_ = dir[0].trim(); serverInfoDefaultWaitCount_ = Integer.parseInt(waitCount[0]); if (nameServerInfo.waitCount == 0) nameServerInfo.waitCount = serverInfoDefaultWaitCount_; if (nameServerInfo.dir.equals("")) nameServerInfo.dir = serverInfoDefaultDir_; }
From source file:com.generalrobotix.ui.util.GrxServerManager.java
License:Open Source License
private String comToAbsolutePath(String com) { if ((new File(com)).isAbsolute()) return null; IPreferenceStore store = Activator.getDefault().getPreferenceStore(); String serverDir = store.getString("SERVER_DIR"); if (!serverDir.equals("")) { File file = new File(serverDir); String[] list = file.list(); for (int i = 0; i < list.length; i++) { int endIndex = list[i].lastIndexOf("."); if (endIndex < 0) endIndex = list[i].length(); String s = list[i].substring(0, endIndex); if (s.equals(com)) { return serverDir + "/" + com; }/*from w w w .j a va2s. c om*/ } } return null; }
From source file:com.github.ipaas.ideploy.plugin.ui.preference.CrsPreferencePage.java
License:Apache License
protected void initialize() { // super.initialize(); IPreferenceStore store = Activator.getDefault().getPreferenceStore(); String hostStr = store.getString("host"); host.setStringValue(hostStr);/* w ww . j ava 2 s . c o m*/ String email = store.getString("email"); account.setStringValue(email); try { DESPlus plus = new DESPlus(email);// ??? String pwdValue = store.getString("password"); password.setStringValue(plus.decrypt(pwdValue));// } catch (Exception e) { ConsoleHandler.error("??:" + e.getMessage()); } String patternsJson = store.getString("patternsJson"); if (patternsJson != null || !patternsJson.trim().equals("")) { List<String> jsonList = JsonUtil.toBean(patternsJson, List.class); for (String json : jsonList) { FilterPattern pattern = JsonUtil.toBean(json, FilterPattern.class); this.addTableItem(pattern.isChecked(), pattern.getName(), pattern.getPattern(), table); } } // for (int i = 0; i <= 4; i++) { // this.addTableItem(true, "?" + String.valueOf(i), "config" + // String.valueOf(i), table); // } }
From source file:com.github.ipaas.ideploy.plugin.ui.preference.CrsPreferencePage.java
License:Apache License
/** * ?,/*from www.jav a 2 s .c o m*/ */ public void init(IWorkbench workbench) { setPreferenceStore(Activator.getDefault().getPreferenceStore()); IPreferenceStore store = Activator.getDefault().getPreferenceStore(); String host = store.getString("host"); ConsoleHandler.info(host); if (host == null || host.trim().equals("")) { store.setValue("host", "ideploy.ipaas.com"); } // ? List<String> defaultPatterns = new ArrayList<String>(); defaultPatterns.add(JsonUtil.toJson(new FilterPattern("resinTmp", "WEB-INF/tmp", true))); defaultPatterns.add(JsonUtil.toJson(new FilterPattern("resinWork", "WEB-INF/work", true))); defaultPatterns.add(JsonUtil.toJson(new FilterPattern("resinConf", "WEB-INF/classes/config", false))); defaultPatterns.add(JsonUtil.toJson(new FilterPattern("iceConf", "resources/config", false))); defaultPatterns.add(JsonUtil.toJson(new FilterPattern("iceStart", "bin/ice.sh", false))); defaultPatterns.add(JsonUtil.toJson(new FilterPattern("iceStart", "bin/ice.sh", false))); String patternsJson = store.getString("patternsJson"); if (patternsJson == null || patternsJson.trim().equals("")) { store.setValue("patternsJson", JsonUtil.toJson(defaultPatterns)); } }
From source file:com.github.ipaas.ideploy.plugin.ui.preference.CrsPreferencePage.java
License:Apache License
public static UserInfo getUserInfo() { IPreferenceStore store = Activator.getDefault().getPreferenceStore(); String email = store.getString("email"); user.setEmail(email);/*from ww w. ja v a2 s .com*/ try { DESPlus plus = new DESPlus(email);// ??? String pwdValue = store.getString("password"); user.setPassword(plus.decrypt(pwdValue));// } catch (Exception e) { ConsoleHandler.error("??:" + e.getMessage()); } user.setUrl(store.getString("host")); String patternsJson = store.getString("patternsJson"); if (patternsJson != null || !patternsJson.trim().equals("")) { user.setPatternJsonList(JsonUtil.toBean(patternsJson, List.class)); } else { user.setPatternJsonList(new ArrayList<String>()); } return user; }
From source file:com.github.picologger.eclipse.syslogcat.preference.PreferenceInitializer.java
License:Apache License
/** * Initializes the preferences of ddmlib and ddmuilib with values from the eclipse store. *//*from www. j av a2 s .com*/ public synchronized static void setupPreferences() { IPreferenceStore store = DdmsPlugin.getDefault().getPreferenceStore(); DdmPreferences.setDebugPortBase(store.getInt(ATTR_DEBUG_PORT_BASE)); DdmPreferences.setSelectedDebugPort(store.getInt(ATTR_SELECTED_DEBUG_PORT)); DdmPreferences.setLogLevel(store.getString(ATTR_LOG_LEVEL)); DdmPreferences.setInitialThreadUpdate(store.getBoolean(ATTR_DEFAULT_THREAD_UPDATE)); DdmPreferences.setInitialHeapUpdate(store.getBoolean(ATTR_DEFAULT_HEAP_UPDATE)); DdmUiPreferences.setThreadRefreshInterval(store.getInt(ATTR_THREAD_INTERVAL)); DdmPreferences.setTimeOut(store.getInt(ATTR_TIME_OUT)); }
From source file:com.google.dart.tools.deploy.ApplicationActionBarAdvisor.java
License:Open Source License
/** * Creates the feature-dependent actions for the menu bar. */// ww w. ja v a2 s . c om private void makeFeatureDependentActions(IWorkbenchWindow window) { IPreferenceStore prefs = IDEWorkbenchPlugin.getDefault().getPreferenceStore(); // Optimization: avoid obtaining the about infos if the platform state is // unchanged from last time. See bug 75130 for details. String stateKey = "platformState"; //$NON-NLS-1$ String prevState = prefs.getString(stateKey); String currentState = String.valueOf(Platform.getStateStamp()); boolean sameState = currentState.equals(prevState); if (!sameState) { prefs.putValue(stateKey, currentState); } }