public IStatus undo(Map<String, Object> parameters) { Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR); String propName = (String) parameters.get(ActionConstants.PARM_PROP_NAME); if (propName == null) return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PROP_NAME, ID)); String previous = (String) getMemento().get(ActionConstants.PARM_PREVIOUS_VALUE); manipulator.getConfigData().setProperty(propName, previous); return Status.OK_STATUS; }
public IStatus undo(Map<String, Object> parameters) { Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR); String propName = (String) parameters.get(ActionConstants.PARM_PROP_NAME); if (propName == null) return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PROP_NAME, ID)); String previous = (String) getMemento().get(ActionConstants.PARM_PREVIOUS_VALUE); manipulator.getConfigData().setProperty(propName, previous); return Status.OK_STATUS; }
public IStatus undo(Map<String, Object> parameters) { Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR); String propName = (String) parameters.get(ActionConstants.PARM_PROP_NAME); if (propName == null) return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PROP_NAME, ID)); String previousValue = (String) getMemento().get(ActionConstants.PARM_PREVIOUS_VALUE); manipulator.getConfigData().setProperty(propName, previousValue); return Status.OK_STATUS; } }
public IStatus undo(Map<String, Object> parameters) { Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR); String propName = (String) parameters.get(ActionConstants.PARM_PROP_NAME); if (propName == null) return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PROP_NAME, ID)); String previous = (String) getMemento().get(ActionConstants.PARM_PREVIOUS_VALUE); manipulator.getConfigData().setProperty(propName, previous); return Status.OK_STATUS; }
public IStatus undo(Map<String, Object> parameters) { Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR); String propName = (String) parameters.get(ActionConstants.PARM_PROP_NAME); if (propName == null) return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PROP_NAME, ID)); String previousValue = (String) getMemento().get(ActionConstants.PARM_PREVIOUS_VALUE); manipulator.getConfigData().setProperty(propName, previousValue); return Status.OK_STATUS; } }
public IStatus undo(Map<String, Object> parameters) { Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR); String propName = (String) parameters.get(ActionConstants.PARM_PROP_NAME); if (propName == null) return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PROP_NAME, ID)); String previous = (String) getMemento().get(ActionConstants.PARM_PREVIOUS_VALUE); manipulator.getConfigData().setProperty(propName, previous); return Status.OK_STATUS; }
public IStatus execute(Map<String, Object> parameters) { Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR); String propName = (String) parameters.get(ActionConstants.PARM_PROP_NAME); if (propName == null) return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PROP_NAME, ID)); String propValue = (String) parameters.get(ActionConstants.PARM_PROP_VALUE); if (propValue != null && propValue.equals(ActionConstants.PARM_AT_ARTIFACT)) { try { propValue = Util.resolveArtifactParam(parameters); } catch (CoreException e) { return e.getStatus(); } } getMemento().put(ActionConstants.PARM_PREVIOUS_VALUE, manipulator.getConfigData().getProperty(propName)); manipulator.getConfigData().setProperty(propName, propValue); return Status.OK_STATUS; }
public IStatus execute(Map<String, Object> parameters) { Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR); String propName = (String) parameters.get(ActionConstants.PARM_PROP_NAME); if (propName == null) return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PROP_NAME, ID)); String propValue = (String) parameters.get(ActionConstants.PARM_PROP_VALUE); if (propValue != null && propValue.equals(ActionConstants.PARM_AT_ARTIFACT)) { try { propValue = Util.resolveArtifactParam(parameters); } catch (CoreException e) { return e.getStatus(); } } getMemento().put(ActionConstants.PARM_PREVIOUS_VALUE, manipulator.getConfigData().getProperty(propName)); manipulator.getConfigData().setProperty(propName, propValue); return Status.OK_STATUS; }
public IStatus execute(Map<String, Object> parameters) { Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR); String propName = (String) parameters.get(ActionConstants.PARM_PROP_NAME); if (propName == null) return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PROP_NAME, ID)); String propValue = (String) parameters.get(ActionConstants.PARM_PROP_VALUE); ConfigData data = manipulator.getConfigData(); String previous = data.getProperty(propName); if (previous == null) return Status.OK_STATUS; // make a backup - even if it is null getMemento().put(ActionConstants.PARM_PREVIOUS_VALUE, previous); // if the value is null, remove the key/value pair. if (propValue == null) { data.setProperty(propName, null); return Status.OK_STATUS; } // Otherwise treat the current value as a comma-separated list and remove // just the one value that was specified. List<String> list = AddProgramPropertyAction.convertToList(previous); // if the value wasn't in the list, then just return if (!list.remove(propValue)) return Status.OK_STATUS; // otherwise set the property to the new value, or remove it if it is now empty propValue = list.isEmpty() ? null : AddProgramPropertyAction.convertToString(list); data.setProperty(propName, propValue); return Status.OK_STATUS; }
public BundleInfo[] save(Manipulator manipulator, boolean backup) throws IOException { List<BundleInfo> setToInitialConfig = new LinkedList<BundleInfo>(); List<BundleInfo> setToSimpleConfig = new LinkedList<BundleInfo>(); ConfigData configData = manipulator.getConfigData(); if (!divideBundleInfos(manipulator, setToInitialConfig, setToSimpleConfig, configData.getInitialBundleStartLevel())) return configData.getBundles(); File outputFile = getConfigFile(manipulator); URI installArea = ParserUtils.getOSGiInstallArea(Arrays.asList(manipulator.getLauncherData().getProgramArgs()), manipulator.getConfigData().getProperties(), manipulator.getLauncherData()).toURI(); saveConfiguration(setToSimpleConfig.toArray(new BundleInfo[setToSimpleConfig.size()]), outputFile, installArea, backup); configData.setProperty(SimpleConfiguratorManipulatorImpl.PROP_KEY_CONFIGURL, outputFile.toURL().toExternalForm()); return orderingInitialConfig(setToInitialConfig); }
public IStatus execute(Map<String, Object> parameters) { Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR); String propName = (String) parameters.get(ActionConstants.PARM_PROP_NAME); if (propName == null) return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PROP_NAME, ID)); String propValue = (String) parameters.get(ActionConstants.PARM_PROP_VALUE); ConfigData data = manipulator.getConfigData(); String previous = data.getProperty(propName); if (previous == null) return Status.OK_STATUS; // make a backup - even if it is null getMemento().put(ActionConstants.PARM_PREVIOUS_VALUE, previous); // if the value is null, remove the key/value pair. if (propValue == null) { data.setProperty(propName, null); return Status.OK_STATUS; } // Otherwise treat the current value as a comma-separated list and remove // just the one value that was specified. List<String> list = AddProgramPropertyAction.convertToList(previous); // if the value wasn't in the list, then just return if (!list.remove(propValue)) return Status.OK_STATUS; // otherwise set the property to the new value, or remove it if it is now empty propValue = list.isEmpty() ? null : AddProgramPropertyAction.convertToString(list); data.setProperty(propName, propValue); return Status.OK_STATUS; }
public IStatus execute(Map<String, Object> parameters) { Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR); String propName = (String) parameters.get(ActionConstants.PARM_PROP_NAME); if (propName == null) return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PROP_NAME, ID)); String propValue = (String) parameters.get(ActionConstants.PARM_PROP_VALUE); if (propValue == null) return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PROP_VALUE, ID)); if (propValue != null && propValue.equals(ActionConstants.PARM_AT_ARTIFACT)) { try { propValue = Util.resolveArtifactParam(parameters); } catch (CoreException e) { return e.getStatus(); } } // if there was no value previously, then just set our key/value pair and return. // otherwise we have to merge. ConfigData data = manipulator.getConfigData(); String previous = data.getProperty(propName); // make a backup - even if it is null getMemento().put(ActionConstants.PARM_PREVIOUS_VALUE, previous); // assume the value is a comma-separated list and just add ourselves to the end if (previous != null) propValue = previous + ',' + propValue; data.setProperty(propName, propValue); return Status.OK_STATUS; }
public BundleInfo[] save(Manipulator manipulator, boolean backup) throws IOException { List setToInitialConfig = new LinkedList(); List setToSimpleConfig = new LinkedList(); ConfigData configData = manipulator.getConfigData(); if (!divideBundleInfos(manipulator, setToInitialConfig, setToSimpleConfig, configData.getInitialBundleStartLevel())) return configData.getBundles(); File outputFile = getConfigFile(manipulator); URI installArea = ParserUtils.getOSGiInstallArea(Arrays.asList(manipulator.getLauncherData().getProgramArgs()), manipulator.getConfigData().getProperties(), manipulator.getLauncherData()).toURI(); saveConfiguration((BundleInfo[]) setToSimpleConfig.toArray(new BundleInfo[setToSimpleConfig.size()]), outputFile, installArea, backup); configData.setProperty(SimpleConfiguratorManipulatorImpl.PROP_KEY_CONFIGURL, outputFile.toURL().toExternalForm()); return orderingInitialConfig(setToInitialConfig); }
public BundleInfo[] save(Manipulator manipulator, boolean backup) throws IOException { List<BundleInfo> setToInitialConfig = new LinkedList<BundleInfo>(); List<BundleInfo> setToSimpleConfig = new LinkedList<BundleInfo>(); ConfigData configData = manipulator.getConfigData(); if (!divideBundleInfos(manipulator, setToInitialConfig, setToSimpleConfig, configData.getInitialBundleStartLevel())) return configData.getBundles(); File outputFile = getConfigFile(manipulator); URI installArea = ParserUtils.getOSGiInstallArea(Arrays.asList(manipulator.getLauncherData().getProgramArgs()), manipulator.getConfigData().getProperties(), manipulator.getLauncherData()).toURI(); saveConfiguration(setToSimpleConfig.toArray(new BundleInfo[setToSimpleConfig.size()]), outputFile, installArea, backup); configData.setProperty(SimpleConfiguratorManipulatorImpl.PROP_KEY_CONFIGURL, outputFile.toURL().toExternalForm()); return orderingInitialConfig(setToInitialConfig); }
public IStatus execute(Map<String, Object> parameters) { Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR); String propName = (String) parameters.get(ActionConstants.PARM_PROP_NAME); if (propName == null) return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PROP_NAME, ID)); String propValue = (String) parameters.get(ActionConstants.PARM_PROP_VALUE); if (propValue == null) return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PROP_VALUE, ID)); if (propValue != null && propValue.equals(ActionConstants.PARM_AT_ARTIFACT)) { try { propValue = Util.resolveArtifactParam(parameters); } catch (CoreException e) { return e.getStatus(); } } // if there was no value previously, then just set our key/value pair and return. // otherwise we have to merge. ConfigData data = manipulator.getConfigData(); String previous = data.getProperty(propName); // make a backup - even if it is null getMemento().put(ActionConstants.PARM_PREVIOUS_VALUE, previous); // assume the value is a comma-separated list and just add ourselves to the end if (previous != null) propValue = previous + ',' + propValue; data.setProperty(propName, propValue); return Status.OK_STATUS; }
private ConfigData getConfigData() { DataLoader loader = createDataLoader(); ConfigData result; if (loader != null) { result = loader.getConfigData(); } else result = generateConfigData(); addProductFileBundles(result); // these are the bundles specified in the <plugins/> tag addProductFileConfigBundles(result); // these are the bundles specified in the <configurations> tag in the product file if (product.getProductId() != null) result.setProperty("eclipse.product", product.getProductId()); //$NON-NLS-1$ if (product.getApplication() != null) result.setProperty("eclipse.application", product.getApplication()); //$NON-NLS-1$ String location = getSplashLocation(); if (location != null) result.setProperty(OSGI_SPLASH_PATH, SPLASH_PREFIX + location); return result; }
private ConfigData getConfigData() { DataLoader loader = createDataLoader(); ConfigData result; if (loader != null) { result = loader.getConfigData(); } else result = generateConfigData(); addProductFileBundles(result); // these are the bundles specified in the <plugins/> tag addProductFileConfigBundles(result); // these are the bundles specified in the <configurations> tag in the product file if (product.getProductId() != null) result.setProperty("eclipse.product", product.getProductId()); //$NON-NLS-1$ if (product.getApplication() != null) result.setProperty("eclipse.application", product.getApplication()); //$NON-NLS-1$ String location = getSplashLocation(); if (location != null) result.setProperty(OSGI_SPLASH_PATH, SPLASH_PREFIX + location); return result; }
private ConfigData getConfigData() { DataLoader loader = createDataLoader(); ConfigData result; if (loader != null) { result = loader.getConfigData(); } else result = generateConfigData(); addProductFileBundles(result); // these are the bundles specified in the <plugins/> tag addProductFileConfigBundles(result); // these are the bundles specified in the <configurations> tag in the product file if (product.getProductId() != null) result.setProperty("eclipse.product", product.getProductId()); //$NON-NLS-1$ if (product.getApplication() != null) result.setProperty("eclipse.application", product.getApplication()); //$NON-NLS-1$ String location = getSplashLocation(); if (location != null) result.setProperty(OSGI_SPLASH_PATH, SPLASH_PREFIX + location); return result; }
private void loadDelegate() { if (manipulator != null) return; manipulator = getFrameworkManipulator(); if (manipulator == null) throw new IllegalStateException(Messages.failed_acquire_framework_manipulator); LauncherData launcherData = manipulator.getLauncherData(); launcherData.setFwConfigLocation(Util.getConfigurationFolder(profile)); launcherData.setLauncher(Util.getLauncherPath(profile)); launcherData.setLauncherConfigLocation(Util.getLauncherConfigLocation(profile)); launcherData.setOS(Util.isMacOSBundled(profile) ? org.eclipse.equinox.p2.core.spi.Constants.MACOSX_BUNDLED : Util.getOSFromProfile(profile)); launcherData.setHome(Util.getInstallFolder(profile)); try { manipulator.load(); } catch (IllegalStateException e) { //if fwJar is not included, this exception will be thrown. But ignore it. LogHelper.log(Util.createError(Messages.error_loading_manipulator, e)); throw new IllegalStateException(Messages.error_loading_manipulator); } catch (FrameworkAdminRuntimeException e) { LogHelper.log(Util.createError(Messages.error_loading_manipulator, e)); } catch (IOException e) { LogHelper.log(Util.createError(Messages.error_loading_manipulator, e)); throw new IllegalStateException(Messages.error_loading_manipulator); } //TODO These values should be inserted by a configuration unit (bug 204124) manipulator.getConfigData().setProperty("eclipse.p2.profile", profile.getProfileId()); //$NON-NLS-1$ manipulator.getConfigData().setProperty("eclipse.p2.data.area", Util.getAgentLocation(agent).getRootLocation().toString()); //$NON-NLS-1$ }
private void loadDelegate() { if (manipulator != null) return; manipulator = getFrameworkManipulator(); if (manipulator == null) throw new IllegalStateException(Messages.failed_acquire_framework_manipulator); LauncherData launcherData = manipulator.getLauncherData(); launcherData.setFwConfigLocation(Util.getConfigurationFolder(profile)); launcherData.setLauncher(Util.getLauncherPath(profile)); launcherData.setLauncherConfigLocation(Util.getLauncherConfigLocation(profile)); launcherData.setOS(Util.getOSFromProfile(profile)); launcherData.setHome(Util.getInstallFolder(profile)); try { manipulator.load(); } catch (IllegalStateException e) { //if fwJar is not included, this exception will be thrown. But ignore it. LogHelper.log(Util.createError(Messages.error_loading_manipulator, e)); throw new IllegalStateException(Messages.error_loading_manipulator); } catch (FrameworkAdminRuntimeException e) { LogHelper.log(Util.createError(Messages.error_loading_manipulator, e)); } catch (IOException e) { LogHelper.log(Util.createError(Messages.error_loading_manipulator, e)); throw new IllegalStateException(Messages.error_loading_manipulator); } //TODO These values should be inserted by a configuration unit (bug 204124) manipulator.getConfigData().setProperty("eclipse.p2.profile", profile.getProfileId()); //$NON-NLS-1$ manipulator.getConfigData().setProperty("eclipse.p2.data.area", Util.getAgentLocation(agent).getRootLocation().toString()); //$NON-NLS-1$ }