private void setTextPresenterProperties() { configuration.setVariable(MuSnapshot.TEXT_FILE_PRESENTER_FULL_SCREEN, TextViewer.isFullScreen()); configuration.setVariable(MuSnapshot.TEXT_FILE_PRESENTER_LINE_WRAP, TextViewer.isLineWrap()); configuration.setVariable(MuSnapshot.TEXT_FILE_PRESENTER_LINE_NUMBERS, TextViewer.isLineNumbers()); }
public boolean setVariable(MuPreference preference, List<String> value, String separator) { return configuration.setVariable(preference.toString(), value, separator); }
public boolean setVariable(MuPreference preference, long value) { return configuration.setVariable(preference.toString(), value); }
public boolean setVariable(MuPreference preference, int value) { return configuration.setVariable(preference.toString(), value); }
public boolean setVariable(MuPreference preference, float value) { return configuration.setVariable(preference.toString(), value); }
public boolean setVariable(MuPreference preference, boolean value) { return configuration.setVariable(preference.toString(), value); }
public boolean setVariable(MuPreference preference, String value) { return configuration.setVariable(preference.toString(), value); }
public boolean setVariable(MuPreference preference, double value) { return configuration.setVariable(preference.toString(), value); }
/** * Sets the value of the specified variable. * <p> * This method will return <code>false</code> if it didn't modify <code>name</code>'s value. This, however, is not * a way of indicating that the call failed: <code>false</code> is only ever returned if the previous value is equal * to the new value. * </p> * <p> * If the value of the specified variable is actually modified, an {@link ConfigurationEvent event} will be passed * to all LISTENERS. * </p> * @param name fully qualified name of the variable to set. * @param value new value for the variable. * @return <code>true</code> if this call resulted in a modification of the variable's value, * <code>false</code> otherwise. * @see #getFloatVariable(String) * @see #getVariable(String,float) */ public boolean setVariable(String name, float value) {return setVariable(name, ConfigurationSection.getValue(value));}
/** * Moves the value of <code>fromVar</code> to <code>toVar</code>. * <p> * At the end of this call, <code>fromVar</code> will have been deleted. Note that if <code>fromVar</code> doesn't * exist, but <code>toVar</code> does, <code>toVar</code> will be deleted. * </p> * <p> * This method might trigger as many as two {@link ConfigurationEvent events}: * <ul> * <li>One when <code>fromVar</code> is removed.</li> * <li>One when <code>toVar</code> is set.</li> * </ul> * The removal event will always be triggered first. * </p> * @param fromVar fully qualified name of the variable to rename. * @param toVar fully qualified name of the variable that will receive <code>fromVar</code>'s value. */ public void renameVariable(String fromVar, String toVar) { setVariable(toVar, removeVariable(fromVar)); }
/** * Sets the value of the specified variable. * <p> * This method will return <code>false</code> if it didn't modify <code>name</code>'s value. This, however, is not a * way of indicating that the call failed: <code>false</code> is only ever returned if the previous value is equal * to the new value. * </p> * <p> * If the value of the specified variable is actually modified, an {@link ConfigurationEvent event} will be passed * to all LISTENERS. * </p> * @param name fully qualified name of the variable to set. * @param value new value for the variable. * @return <code>true</code> if this call resulted in a modification of the variable's value, * <code>false</code> otherwise. * @see #getDoubleVariable(String) * @see #getVariable(String,double) */ public boolean setVariable(String name, double value) {return setVariable(name, ConfigurationSection.getValue(value));}
/** * Sets the value of the specified variable. * <p> * This method will return <code>false</code> if it didn't modify <code>name</code>'s value. This, however, is not a * way of indicating that the call failed: <code>false</code> is only ever returned if the previous value is equal * to the new value. * </p> * <p> * If the value of the specified variable is actually modified, an {@link ConfigurationEvent event} will be passed * to all LISTENERS. * </p> * @param name fully qualified name of the variable to set. * @param value new value for the variable. * @return <code>true</code> if this call resulted in a modification of the variable's value, * <code>false</code> otherwise. * @see #getIntegerVariable(String) * @see #getVariable(String,int) */ public boolean setVariable(String name, int value) { return setVariable(name, ConfigurationSection.getValue(value)); }
/** * Sets the value of the specified variable. * <p> * This method will return <code>false</code> if it didn't modify <code>name</code>'s value. This, however, is not a * way of indicating that the call failed: <code>false</code> is only ever returned if the previous value is equal * to the new value. * </p> * <p> * If the value of the specified variable is actually modified, an {@link ConfigurationEvent event} will be passed * to all LISTENERS. * </p> * @param name fully qualified name of the variable to set. * @param value new value for the variable. * @return <code>true</code> if this call resulted in a modification of the variable's value, * <code>false</code> otherwise. * @see #getBooleanVariable(String) * @see #getVariable(String,boolean) */ public boolean setVariable(String name, boolean value) { return setVariable(name, ConfigurationSection.getValue(value)); }
/** * Sets the value of the specified variable. * <p> * This method will return <code>false</code> if it didn't modify <code>name</code>'s value. This, however, is not a * way of indicating that the call failed: <code>false</code> is only ever returned if the previous value is equal * to the new value. * </p> * <p> * If the value of the specified variable is actually modified, an {@link ConfigurationEvent event} will be passed * to all LISTENERS. * </p> * @param name fully qualified name of the variable to set. * @param value new value for the variable. * @return <code>true</code> if this call resulted in a modification of the variable's value, * <code>false</code> otherwise. * @see #getLongVariable(String) * @see #getVariable(String,long) */ public boolean setVariable(String name, long value) { return setVariable(name, ConfigurationSection.getValue(value)); }
private void setGlobalHistory() { List<FileURL> locations = GlobalLocationHistory.Instance().getHistory(); configuration.setVariable(getRecentLocationsCountVariable(), locations.size()); Iterator<FileURL> iterator = locations.iterator(); for (int i=0; iterator.hasNext(); ++i) configuration.setVariable(getRecentLocationVariable(i), iterator.next().toString()); }
private void setWindowAttributes(int index, MainFrame currentMainFrame) { Rectangle bounds = currentMainFrame.getBounds(); configuration.setVariable(getX(index), (int)bounds.getX()); configuration.setVariable(getY(index), (int)bounds.getY()); configuration.setVariable(getWidth(index), (int)bounds.getWidth()); configuration.setVariable(getHeight(index), (int)bounds.getHeight()); // Save split pane orientation // Note: the vertical/horizontal terminology used in muCommander is just the opposite of the one used // in JSplitPane which is anti-natural / confusing configuration.setVariable(getSplitOrientation(index), currentMainFrame.getSplitPane().getOrientation()==JSplitPane.HORIZONTAL_SPLIT?MuSnapshot.VERTICAL_SPLIT_ORIENTATION:MuSnapshot.HORIZONTAL_SPLIT_ORIENTATION); // Save single panel view toggle state configuration.setVariable(getSinglePanelViewToggleState(index), currentMainFrame.isSinglePanel()); } }
private void setTreeAttributes(int index, boolean isLeft, FolderPanel panel) { configuration.setVariable(MuSnapshot.getTreeVisiblityVariable(index, isLeft), panel.isTreeVisible()); configuration.setVariable(MuSnapshot.getTreeWidthVariable(index, isLeft), panel.getTreeWidth()); }
private void setTabsAttributes(int index, boolean isLeft, FileTableTabs tabs) { int tabsCounter = 0; Iterator<FileTableTab> tabsIterator = tabs.iterator(); // Save tabs locations while (tabsIterator.hasNext()) { FileTableTab tab = tabsIterator.next(); configuration.setVariable(getTabLocationVariable(index, isLeft, tabsCounter), tab.getLocation().toString()); configuration.setVariable(getTabLockedVariable(index, isLeft, tabsCounter), tab.isLocked()); configuration.setVariable(getTabTitleVariable(index, isLeft, tabsCounter), tab.getTitle()); ++tabsCounter; } if (tabsCounter > 0) { // Save tabs count configuration.setVariable(getTabsCountVariable(index, isLeft), tabsCounter); // Save the index of the selected tab configuration.setVariable(getTabsSelectionVariable(index, isLeft), tabs.getSelectedIndex()); } }
/** * Fills the configuration instance with test values. */ @BeforeMethod public void setUp() { StringBuilder buffer; buffer = new StringBuilder(); conf = new Configuration(); for(int i = 0; i < DEPTH; i++) { conf.setVariable(buffer.toString() + VARIABLE_NAME + i, VARIABLE_VALUE + i); buffer.append(SECTION_NAME); buffer.append(i); buffer.append('.'); } }
/** * Saves the muCommander CONFIGURATION. * @throws IOException if an I/O error occurs. * @throws ConfigurationException if a CONFIGURATION related error occurs. */ void write() throws IOException, ConfigurationException { if(configurationVersion != null && !configurationVersion.equals(RuntimeConstants.VERSION)) { // Clear the configuration before saving to drop preferences which are unused anymore Configuration conf = new Configuration(MuPreferencesFile.getPreferencesFile(), new VersionedXmlConfigurationReaderFactory(), new VersionedXmlConfigurationWriterFactory(ROOT_ELEMENT)); for (MuPreference preference : MuPreference.values()) conf.setVariable(preference.toString(), configuration.getVariable(preference.toString())); // Remove preferences which are not relevant if we're not using MAC if (!OsFamily.MAC_OS_X.isCurrent()) { conf.removeVariable(USE_BRUSHED_METAL); conf.removeVariable(USE_SCREEN_MENU_BAR); } configuration = conf; } configuration.write(); }