當前位置: 首頁>>代碼示例>>Java>>正文


Java Utilities.compareObjects方法代碼示例

本文整理匯總了Java中org.openide.util.Utilities.compareObjects方法的典型用法代碼示例。如果您正苦於以下問題:Java Utilities.compareObjects方法的具體用法?Java Utilities.compareObjects怎麽用?Java Utilities.compareObjects使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.openide.util.Utilities的用法示例。


在下文中一共展示了Utilities.compareObjects方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: updateProperty

import org.openide.util.Utilities; //導入方法依賴的package包/類
/**
* Updates the value of existing property in editable properties if value differs.
* If value is not set or is set empty, removes property from editable properties
* unless storeEmpty==true, in which case the property is preserved and set to empty
* in editable properties.
* 
* @param name property to be updated
* @param value new property value
* @param projectProperties project editable properties
* @param privateProperties private project editable properties
* @param storeEmpty true==keep empty properties in editable properties, false==remove empty properties
* @return true if private properties have been edited
*/
private boolean updateProperty(@NonNull String name, String value, @NonNull EditableProperties projectProperties, @NonNull EditableProperties privateProperties, boolean storeEmpty) {
    boolean changePrivate = PRIVATE_PROPERTIES.contains(name) || privateProperties.containsKey(name);
    EditableProperties ep = changePrivate ? privateProperties : projectProperties;
    if(changePrivate) {
        projectProperties.remove(name);
    }
    if (!Utilities.compareObjects(value, ep.getProperty(name))) {
        if (value != null && (value.length() > 0 || storeEmpty)) {
            ep.setProperty(name, value);
        } else {
            ep.remove(name);
        }
        return changePrivate;
    }
    return false;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:30,代碼來源:JFXProjectConfigurations.java

示例2: updateHelp

import org.openide.util.Utilities; //導入方法依賴的package包/類
private void updateHelp() {
    //System.err.println ("Updating help for NbDialog...");
    HelpCtx help = getHelpCtx();
    // Handle help from the inner component automatically (see docs
    // in DialogDescriptor):
    if (HelpCtx.DEFAULT_HELP.equals(help)) {
        Object msg = descriptor.getMessage();
        if (msg instanceof Component) {
            help = HelpCtx.findHelp((Component) msg);
        }
        if (HelpCtx.DEFAULT_HELP.equals(help)) help = null;
    }
    if (! Utilities.compareObjects(currentHelp, help)) {
        currentHelp = help;
        if (help != null && help.getHelpID() != null) {
            //System.err.println ("New help ID for root pane: " + help.getHelpID ());
            HelpCtx.setHelpIDString(getRootPane(), help.getHelpID());
        }
        // Refresh button list if it had already been created.
        if (haveCalledInitializeButtons) initializeButtons();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:23,代碼來源:NbPresenter.java

示例3: updateDBSchemas

import org.openide.util.Utilities; //導入方法依賴的package包/類
private static FileObject updateDBSchemas(SchemaElement schemaElement, DBSchemaFileList dbschemaFileList) throws IOException {
    FileObject updatedDBSchemaFile = null;
    DBIdentifier schemaFullName = schemaElement.getSchema();
    String schemaName = schemaFullName != null ? schemaFullName.getName() : null;

    for (FileObject dbschemaFile : dbschemaFileList.getFileList()) {
        SchemaElement existingSchemaElement = SchemaElementUtil.forName(dbschemaFile);
        DBIdentifier existingSchemaFullName = existingSchemaElement.getSchema();
        String existingSchemaName = existingSchemaFullName != null ? existingSchemaFullName.getName() : null;

        if (Utilities.compareObjects(existingSchemaElement.getUrl(), schemaElement.getUrl()) &&
                Utilities.compareObjects(existingSchemaName, schemaName)) {
            DBIdentifier existingDBSchemaName = existingSchemaElement.getName();
            overwriteDBSchema(schemaElement, dbschemaFile, existingDBSchemaName);
            updatedDBSchemaFile = dbschemaFile;
        }
    }

    return updatedDBSchemaFile;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:21,代碼來源:DBSchemaManager.java

示例4: equals

import org.openide.util.Utilities; //導入方法依賴的package包/類
public @Override boolean equals(Object obj) {
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final MacroDescription other = (MacroDescription) obj;
    if (!Utilities.compareObjects(this.name, other.name)) {
        return false;
    }
    if (!Utilities.compareObjects(this.code, other.code)) {
        return false;
    }
    if (!Utilities.compareObjects(this.description, other.description)) {
        return false;
    }
    if (!Utilities.compareObjects(this.shortcuts, other.shortcuts)) {
        return false;
    }
    return true;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:23,代碼來源:MacroDescription.java

示例5: setOneColoring

import org.openide.util.Utilities; //導入方法依賴的package包/類
private void setOneColoring(String mimeType, AttributeSet coloring) {
    String coloringName = (String) coloring.getAttribute(StyleConstants.NameAttribute);
    FontColorSettingsFactory fcsf = EditorSettingsImpl.getDefault().getFontColorSettings(new String [] { mimeType });
    Collection<AttributeSet> all = new ArrayList<AttributeSet>(fcsf.getAllFontColors(EditorSettingsImpl.DEFAULT_PROFILE));
    
    for(Iterator<AttributeSet> i = all.iterator(); i.hasNext(); ) {
        AttributeSet attribs = (AttributeSet) i.next();
        String name = (String) attribs.getAttribute(StyleConstants.NameAttribute);
        if (Utilities.compareObjects(name, coloringName)) {
            i.remove();
            break;
        }
    }
    
    all.add(coloring);
    fcsf.setAllFontColors(EditorSettingsImpl.DEFAULT_PROFILE, all);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:EditorSettingsStorageTest.java

示例6: addRemoveJAR

import org.openide.util.Utilities; //導入方法依賴的package包/類
private boolean addRemoveJAR(File jar, POMModel mdl, String scope, boolean add) throws IOException {
    if (!add) {
        throw new UnsupportedOperationException("removing JARs not yet supported");
    }
    NBVersionInfo dep = null;
    for (NBVersionInfo _dep : RepositoryQueries.findBySHA1Result(jar, RepositoryPreferences.getInstance().getRepositoryInfos()).getResults()) {
        if (!"unknown.binary".equals(_dep.getGroupId())) {
            dep = _dep;
            break;
        }
    }
    if (dep == null) {
        dep = new NBVersionInfo(null, "unknown.binary", jar.getName().replaceFirst("[.]jar$", ""), "SNAPSHOT", null, null, null, null, null);
        addJarToPrivateRepo(jar, mdl, dep);
    }
    //if not found anywhere, add to a custom file:// based repository structure within the project's directory.
    boolean added = false;
    Dependency dependency = ModelUtils.checkModelDependency(mdl, dep.getGroupId(), dep.getArtifactId(), false);
    if (dependency == null) {
        dependency = ModelUtils.checkModelDependency(mdl, dep.getGroupId(), dep.getArtifactId(), true);
        LOG.log(Level.FINE, "added new dep {0} as {1}", new Object[] {jar, dep});
        added = true;
    }
    if (!Utilities.compareObjects(dep.getVersion(), dependency.getVersion())) {
        dependency.setVersion(dep.getVersion());
        LOG.log(Level.FINE, "upgraded version on {0} as {1}", new Object[] {jar, dep});
        added = true;
    }
    if (!Utilities.compareObjects(scope, dependency.getScope())) {
        dependency.setScope(scope);
        LOG.log(Level.FINE, "changed scope on {0} as {1}", new Object[] {jar, dep});
        added = true;
    }
    return added;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:36,代碼來源:CPExtender.java

示例7: equals

import org.openide.util.Utilities; //導入方法依賴的package包/類
@Override
public boolean equals(Object o) {
    if (o instanceof Message) {
        Message m = (Message) o;
        return m.message.equals(message) && m.err == err && Utilities.compareObjects(m.hyperlink, hyperlink);
    } else {
        return false;
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:10,代碼來源:StandardLoggerTest.java

示例8: equals

import org.openide.util.Utilities; //導入方法依賴的package包/類
public boolean equals(Object o) {
    if (o instanceof ModuleDependency) {
        ModuleDependency other = (ModuleDependency) o;
        return getCodeNameBase().equals(other.getCodeNameBase()) &&
                Utilities.compareObjects(getReleaseVersion(), other.getReleaseVersion()) &&
                ((specVersion == SPEC_VERSION_LAZY && other.specVersion == SPEC_VERSION_LAZY) ||
                Utilities.compareObjects(getSpecificationVersion(), other.getSpecificationVersion())) &&
                (hasImplementationDependency() == other.hasImplementationDependency()) &&
                (hasCompileDependency() == other.hasCompileDependency());
    } else {
        return false;
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:14,代碼來源:ModuleDependency.java

示例9: propertyChange

import org.openide.util.Utilities; //導入方法依賴的package包/類
public void propertyChange(PropertyChangeEvent evt) {
    AbstractButton b = (AbstractButton) evt.getSource();
    if (b.getDisplayedMnemonicIndex() == -1) {
        Integer mnemonic = (Integer) b.getClientProperty(PROP_MNEMONIC);
        Integer index = (Integer) b.getClientProperty(PROP_DISPLAYED_MNEMONIC_INDEX);
        if (mnemonic != null && index != null && Utilities.compareObjects(b.getText(), b.getClientProperty(PROP_TEXT))) {
            b.setMnemonic(mnemonic);
            b.setDisplayedMnemonicIndex(index);
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:Mnemonics.java

示例10: immutize

import org.openide.util.Utilities; //導入方法依賴的package包/類
/**
 * Creates unmodifiable copy of the original map converting <code>AttributeSet</code>s
 * to their immutable versions.
 */
public static Map<String, AttributeSet> immutize(Map<String, ? extends AttributeSet> map, Object... filterOutKeys) {
    Map<String, AttributeSet> immutizedMap = new HashMap<String, AttributeSet>();
    
    for(String name : map.keySet()) {
        AttributeSet attribs = map.get(name);
        
        if (filterOutKeys.length == 0) {
            immutizedMap.put(name, AttributesUtilities.createImmutable(attribs));
        } else {
            List<Object> pairs = new ArrayList<Object>();

            // filter out attributes specified by filterOutKeys
            first:
            for(Enumeration<? extends Object> keys = attribs.getAttributeNames(); keys.hasMoreElements(); ) {
                Object key = keys.nextElement();
                
                for(Object filterOutKey : filterOutKeys) {
                    if (Utilities.compareObjects(key, filterOutKey)) {
                        continue first;
                    }
                }
                
                pairs.add(key);
                pairs.add(attribs.getAttribute(key));
            }

            immutizedMap.put(name, AttributesUtilities.createImmutable(pairs.toArray()));
        }
    }
    
    return Collections.unmodifiableMap(immutizedMap);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:37,代碼來源:NbUtils.java

示例11: setOneKeyBinding

import org.openide.util.Utilities; //導入方法依賴的package包/類
private void setOneKeyBinding(String mimeType, MultiKeyBinding keyBinding) {
    KeyBindingSettingsFactory kbsf = EditorSettingsImpl.getDefault().getKeyBindingSettings(new String [] { mimeType });
    List<MultiKeyBinding> all = new ArrayList<MultiKeyBinding>(kbsf.getKeyBindingDefaults(EditorSettingsImpl.DEFAULT_PROFILE));

    for(Iterator<MultiKeyBinding> i = all.iterator(); i.hasNext(); ) {
        MultiKeyBinding kb = (MultiKeyBinding) i.next();
        if (Utilities.compareObjects(kb.getActionName(), keyBinding.getActionName())) {
            i.remove();
            break;
        }
    }

    all.add(keyBinding);
    kbsf.setKeyBindings(EditorSettingsImpl.DEFAULT_PROFILE, all);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:16,代碼來源:EditorSettingsStorageTest.java

示例12: setComboValue

import org.openide.util.Utilities; //導入方法依賴的package包/類
@Messages("HINT_inherited=Value is inherited from parent POM.")
    private void setComboValue(T value, T projectValue, JComboBox field) {
        if (!Utilities.compareObjects(value, projectValue)) {
            field.setSelectedItem(value != null ? value : field.getModel().getElementAt(0));
            component.setToolTipText(null);
            inherited = false;
            label.setFont(label.getFont().deriveFont(Font.BOLD));
        } else {
            field.setSelectedItem(projectValue != null ? projectValue : field.getModel().getElementAt(0));
//            field.setBackground(INHERITED);
            label.setFont(label.getFont().deriveFont(Font.PLAIN));
            component.setToolTipText(HINT_inherited());
            inherited = true;
      }
    }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:16,代碼來源:ComboBoxUpdater.java

示例13: setBrandingSource

import org.openide.util.Utilities; //導入方法依賴的package包/類
public void setBrandingSource(@NonNull URL brandingSource) {
    Parameters.notNull("brandingSource", brandingSource);
    if (!Utilities.compareObjects(brandingSource, this.brandingSource)) {
        modified = true;
    }
    this.brandingSource = brandingSource;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:8,代碼來源:BrandingSupport.java

示例14: setValue

import org.openide.util.Utilities; //導入方法依賴的package包/類
@Override public void setValue(Boolean value) {
    if (Utilities.compareObjects(value, getValue())) {
        return;
    }

    modifiedValue = value;
    handle.removePOMModification(this);
    if (pomValue != null && pomValue.equals(modifiedValue)) {
        //ignore now, we already have what we want in the project.
    } else {
        handle.addPOMModification(this);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:14,代碼來源:InstallerPanel.java

示例15: setCode

import org.openide.util.Utilities; //導入方法依賴的package包/類
public void setCode(String code) {
    if (Utilities.compareObjects(getCode(), code)) {
        return;
    }
    
    cloneOnModify();
    
    String oldCode = this.code;
    this.code = code;

    pcs.firePropertyChange(PROP_CODE, oldCode, code);
    model.fireChanged();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:14,代碼來源:MacrosModel.java


注:本文中的org.openide.util.Utilities.compareObjects方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。