void SaveConfig() { String id = Long.toString(robot_uid); prefs.put(id + "_limit_top", Double.toString(limit_top)); prefs.put(id + "_limit_bottom", Double.toString(limit_bottom)); prefs.put(id + "_limit_right", Double.toString(limit_right)); prefs.put(id + "_limit_left", Double.toString(limit_left)); prefs.put(id + "_m1invert", Boolean.toString(m1invert)); prefs.put(id + "_m2invert", Boolean.toString(m2invert)); }
@NotNull private Element writeComposite( VirtualFile file, EditorWithProviderComposite composite, boolean pinned, EditorWithProviderComposite selectedEditor) { Element fileElement = new Element("file"); fileElement.setAttribute("leaf-file-name", file.getName()); // TODO: all files composite.currentStateAsHistoryEntry().writeExternal(fileElement, getManager().getProject()); fileElement.setAttribute(PINNED, Boolean.toString(pinned)); fileElement.setAttribute(CURRENT_IN_TAB, Boolean.toString(composite.equals(selectedEditor))); return fileElement; }
private Element generatePortNode(Document doc, Port port) { Element portEl = doc.createElement(EL_PORT); portEl.setAttribute(ATR_NAME, port.getName()); portEl.setAttribute(ATR_TYPE, port.getType()); portEl.setAttribute(ATR_X, Integer.toString(port.getX())); portEl.setAttribute(ATR_Y, Integer.toString(port.getY())); portEl.setAttribute(ATR_PORT_CONNECTION, port.isArea() ? "area" : ""); portEl.setAttribute(ATR_STRICT, Boolean.toString(port.isStrict())); portEl.setAttribute(ATR_MULTI, Boolean.toString(port.isMulti())); return portEl; }
public void writeToLog(String preamble) throws IOException { String dirText = " (top down):"; if (mSearchMethod == JOAConstants.SEARCH_BOTTOM_UP) dirText = " (bottom up):"; try { JOAConstants.LogFileStream.writeBytes(preamble); JOAConstants.LogFileStream.writeBytes( "\t" + "Interpolation " + dirText + " " + mIntVar + " WRT " + mWRTVar + " Int. at Value = " + JOAFormulas.formatDouble(mIntAtValue, 3, false) + " Use deepest = " + Boolean.toString(mUseDeepest) + " At Surface = " + Boolean.toString(mAtSurface) + " Surface Depth Limit = " + JOAFormulas.formatDouble(mSurfaceDepthLimit, 3, false) + " At Bottom = " + Boolean.toString(mAtBottom) + " Interpolate Missing = " + Boolean.toString(mInterpolateMissing) + "\n"); JOAConstants.LogFileStream.flush(); } catch (IOException ex) { throw ex; } }
@Override public Object getValue() { JTextField text = getComboText(); if (text == null) { return myBooleanResourceValue == null ? Boolean.toString(myCheckBox.isSelected()) : myBooleanResourceValue; } String value = text.getText(); if (value == StringsComboEditor.UNSET || StringUtil.isEmpty(value)) { return null; } if (myIsDimension && !value.startsWith("@") && !value.endsWith("dip") && !value.equalsIgnoreCase("wrap_content") && !value.equalsIgnoreCase("fill_parent") && !value.equalsIgnoreCase("match_parent")) { if (value.length() <= 2) { return value + "dp"; } int index = value.length() - 2; String dimension = value.substring(index); if (ArrayUtil.indexOf(ResourceRenderer.DIMENSIONS, dimension) == -1) { return value + "dp"; } } return value; }
private static void saveState(TreeAction action, boolean state) { if (action instanceof PropertyOwner) { final String propertyName = ((PropertyOwner) action).getPropertyName(); PropertiesComponent.getInstance() .setValue(getPropertyName(propertyName), Boolean.toString(state)); } }
private void writeComposite( final Element res, final VirtualFile file, final EditorWithProviderComposite composite, final boolean pinned, final EditorWithProviderComposite selectedEditor) { final Element fileElement = new Element("file"); fileElement.setAttribute("leaf-file-name", file.getName()); // TODO: all files final HistoryEntry entry = composite.currentStateAsHistoryEntry(); entry.writeExternal(fileElement, getManager().getProject()); fileElement.setAttribute("pinned", Boolean.toString(pinned)); fileElement.setAttribute( "current", Boolean.toString(composite.equals(getManager().getLastSelected()))); fileElement.setAttribute("current-in-tab", Boolean.toString(composite.equals(selectedEditor))); res.addContent(fileElement); }
@Override protected void doOKAction() { super.doOKAction(); // Saving checkboxes state PropertiesComponent.getInstance() .setValue( LayoutCodeConstants.OPTIMIZE_IMPORTS_KEY, Boolean.toString(myCbOptimizeImports.isSelected())); PropertiesComponent.getInstance() .setValue( LayoutCodeConstants.REARRANGE_ENTRIES_KEY, Boolean.toString(myCbArrangeEntries.isSelected())); PropertiesComponent.getInstance() .setValue( LayoutCodeConstants.PROCESS_CHANGED_TEXT_KEY, Boolean.toString(myCbOnlyVcsChangedRegions.isSelected())); }
public void saveInitialCheckBoxState(boolean state) { PropertiesComponent propertiesComponent = PropertiesComponent.getInstance(myProject); if (Boolean.TRUE .toString() .equals(propertiesComponent.getValue("GoToAction.toSaveAllIncluded"))) { propertiesComponent.setValue("GoToAction.allIncluded", Boolean.toString(state)); } }
@Override public void dispose() { PropertiesComponent instance = PropertiesComponent.getInstance(); instance.setValue(PROP_SORTED, Boolean.toString(isAlphabeticallySorted())); instance.setValue(PROP_SHOWCLASSES, Boolean.toString(myShowClasses)); if (myCopyJavadocCheckbox != null) { instance.setValue(PROP_COPYJAVADOC, Boolean.toString(myCopyJavadocCheckbox.isSelected())); } final Container contentPane = getContentPane(); if (contentPane != null) { contentPane.removeAll(); } mySelectedNodes.clear(); myElements = null; super.dispose(); }
private Element generateGraphicsNode(Document doc, ClassGraphics gr) { Element graphicsEl = doc.createElement(EL_GRAPHICS); Element bounds = doc.createElement(EL_BOUNDS); graphicsEl.appendChild(bounds); bounds.setAttribute(ATR_X, Integer.toString(gr.getBoundX())); bounds.setAttribute(ATR_Y, Integer.toString(gr.getBoundY())); bounds.setAttribute(ATR_WIDTH, Integer.toString(gr.getBoundWidth())); bounds.setAttribute(ATR_HEIGHT, Integer.toString(gr.getBoundHeight())); for (Shape shape : gr.getShapes()) { if (shape instanceof Rect) { Rect rect = (Rect) shape; Element rectEl = doc.createElement(EL_RECT); graphicsEl.appendChild(rectEl); rectEl.setAttribute(ATR_X, Integer.toString(rect.getX())); rectEl.setAttribute(ATR_Y, Integer.toString(rect.getY())); rectEl.setAttribute(ATR_WIDTH, Integer.toString(rect.getWidth())); rectEl.setAttribute(ATR_HEIGHT, Integer.toString(rect.getHeight())); rectEl.setAttribute(ATR_COLOUR, Integer.toString(rect.getColor().getRGB())); rectEl.setAttribute(ATR_FILLED, Boolean.toString(rect.isFilled())); rectEl.setAttribute(ATR_FIXED, Boolean.toString(rect.isFixed())); rectEl.setAttribute(ATR_STROKE, Float.toString(rect.getStroke().getLineWidth())); rectEl.setAttribute(ATR_LINETYPE, Float.toString(rect.getLineType())); rectEl.setAttribute(ATR_TRANSPARENCY, Integer.toString(rect.getTransparency())); } else if (shape instanceof Text) { Text text = (Text) shape; Element textEl = doc.createElement(EL_TEXT); textEl.setAttribute(ATR_STRING, text.getText()); textEl.setAttribute(ATR_X, Integer.toString(text.getX())); textEl.setAttribute(ATR_Y, Integer.toString(text.getY())); textEl.setAttribute(ATR_FONTNAME, text.getFont().getName()); textEl.setAttribute(ATR_FONTSIZE, Integer.toString(text.getFont().getSize())); textEl.setAttribute(ATR_FONTSTYLE, Integer.toString(text.getFont().getStyle())); textEl.setAttribute(ATR_TRANSPARENCY, Integer.toString(text.getTransparency())); textEl.setAttribute(ATR_COLOUR, Integer.toString(text.getColor().getRGB())); graphicsEl.appendChild(textEl); } // TODO handle the rest of shapes } return graphicsEl; }
@Override public void writeExternal(final Element element) { element.setAttribute(ID_ATTR, myId); element.setAttribute(ACTIVE_ATTR, Boolean.toString(myActive)); element.setAttribute(ANCHOR_ATTR, myAnchor.toString()); element.setAttribute(AUTOHIDE_ATTR, Boolean.toString(myAutoHide)); element.setAttribute(INTERNAL_TYPE_ATTR, myInternalType.toString()); element.setAttribute(TYPE_ATTR, myType.toString()); element.setAttribute(VISIBLE_ATTR, Boolean.toString(myVisible)); element.setAttribute(SHOW_STRIPE_BUTTON, Boolean.toString(myShowStripeButton)); element.setAttribute(WEIGHT_ATTR, Float.toString(myWeight)); element.setAttribute(SIDE_WEIGHT_ATTR, Float.toString(mySideWeight)); element.setAttribute(ORDER_ATTR, Integer.toString(myOrder)); element.setAttribute(SIDE_TOOL_ATTR, Boolean.toString(mySplitMode)); element.setAttribute(CONTENT_UI_ATTR, myContentUiType.getName()); if (myFloatingBounds != null) { element.setAttribute(X_ATTR, Integer.toString(myFloatingBounds.x)); element.setAttribute(Y_ATTR, Integer.toString(myFloatingBounds.y)); element.setAttribute(WIDTH_ATTR, Integer.toString(myFloatingBounds.width)); element.setAttribute(HEIGHT_ATTR, Integer.toString(myFloatingBounds.height)); } }
/** * Returns the set of data that user has entered through this wizard. * * @return Iterator */ @Override public Iterator<Map.Entry<String, String>> getSummary() { Hashtable<String, String> summaryTable = new Hashtable<String, String>(); summaryTable.put( Resources.getString("plugin.jabberaccregwizz.USERNAME"), registration.getUserID()); summaryTable.put( Resources.getString("service.gui.REMEMBER_PASSWORD"), Boolean.toString(registration.isRememberPassword())); summaryTable.put( Resources.getString("plugin.jabberaccregwizz.SERVER"), registration.getServerAddress()); summaryTable.put( Resources.getString("service.gui.PORT"), String.valueOf(registration.getServerPort())); summaryTable.put( Resources.getString("plugin.jabberaccregwizz.ENABLE_KEEP_ALIVE"), String.valueOf(registration.isSendKeepAlive())); summaryTable.put( Resources.getString("plugin.jabberaccregwizz.ENABLE_GMAIL_NOTIFICATIONS"), String.valueOf(registration.isGmailNotificationEnabled())); summaryTable.put( Resources.getString("plugin.jabberaccregwizz.RESOURCE"), registration.getResource()); summaryTable.put( Resources.getString("plugin.jabberaccregwizz.PRIORITY"), String.valueOf(registration.getPriority())); summaryTable.put( Resources.getString("plugin.sipaccregwizz.DTMF_METHOD"), registration.getDTMFMethod()); summaryTable.put( Resources.getString("plugin.sipaccregwizz.DTMF_MINIMAL_TONE_DURATION"), registration.getDtmfMinimalToneDuration()); return summaryTable.entrySet().iterator(); }
public boolean tryToApplyActivationState(boolean active, Window window) { final Component frame = UIUtil.findUltimateParent(window); if (frame instanceof IdeFrame) { final IdeFrame ideFrame = (IdeFrame) frame; if (isActive() != active) { myActive = Boolean.valueOf(active); System.setProperty("idea.active", myActive.toString()); ApplicationActivationListener publisher = getMessageBus().syncPublisher(ApplicationActivationListener.TOPIC); if (active) { publisher.applicationActivated(ideFrame); } else { publisher.applicationDeactivated(ideFrame); } return true; } } return false; }
private static void setToShowTextField(boolean toShowTextField) { PropertiesComponent.getInstance() .setValue(FILE_CHOOSER_SHOW_PATH_PROPERTY, Boolean.toString(toShowTextField)); }
public static boolean getBooleanParameterValue(IExtension ext, String key, boolean defaultValue) { return PropertyUtil.getBoolean( getParameterValue(ext, key, Boolean.toString(defaultValue)), defaultValue); }
/** * Creates an account for the given user and password. * * @param providerFactory the ProtocolProviderFactory which will create the account * @param userName the user identifier * @param passwd the password * @return the <tt>ProtocolProviderService</tt> for the new account. * @throws OperationFailedException if the operation didn't succeed */ protected ProtocolProviderService installAccount( ProtocolProviderFactory providerFactory, String userName, String passwd) throws OperationFailedException { if (logger.isTraceEnabled()) { logger.trace("Preparing to install account for user " + userName); } Hashtable<String, String> accountProperties = new Hashtable<String, String>(); String protocolIconPath = getProtocolIconPath(); String accountIconPath = getAccountIconPath(); registration.storeProperties( userName, passwd, protocolIconPath, accountIconPath, accountProperties); accountProperties.put( ProtocolProviderFactory.IS_PREFERRED_PROTOCOL, Boolean.toString(isPreferredProtocol())); accountProperties.put(ProtocolProviderFactory.PROTOCOL, getProtocol()); if (isModification()) { providerFactory.modifyAccount(protocolProvider, accountProperties); setModification(false); return protocolProvider; } try { if (logger.isTraceEnabled()) { logger.trace( "Will install account for user " + userName + " with the following properties." + accountProperties); } AccountID accountID = providerFactory.installAccount(userName, accountProperties); ServiceReference serRef = providerFactory.getProviderForAccount(accountID); protocolProvider = (ProtocolProviderService) JabberAccRegWizzActivator.bundleContext.getService(serRef); } catch (IllegalArgumentException exc) { logger.warn(exc.getMessage()); throw new OperationFailedException( "Username, password or server is null.", OperationFailedException.ILLEGAL_ARGUMENT); } catch (IllegalStateException exc) { logger.warn(exc.getMessage()); throw new OperationFailedException( "Account already exists.", OperationFailedException.IDENTIFICATION_CONFLICT); } catch (Throwable exc) { logger.warn(exc.getMessage()); throw new OperationFailedException( "Failed to add account.", OperationFailedException.GENERAL_ERROR); } return protocolProvider; }