当前位置: 首页>>代码示例>>Java>>正文


Java NbPreferences类代码示例

本文整理汇总了Java中org.openide.util.NbPreferences的典型用法代码示例。如果您正苦于以下问题:Java NbPreferences类的具体用法?Java NbPreferences怎么用?Java NbPreferences使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


NbPreferences类属于org.openide.util包,在下文中一共展示了NbPreferences类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: load

import org.openide.util.NbPreferences; //导入依赖的package包/类
public void load() throws IOException {
    filters.clear();
    active = -1;
    Preferences prefs = NbPreferences.forModule(FilterRepository.class);
    prefs = prefs.node("Filters"); //NOI18N
    active = prefs.getInt("active", -1);

    int count = prefs.getInt("count", 0); //NOI18N
    for (int i = 0; i < count; i++) {
        NotificationFilter filter = new NotificationFilter();
        try {
            filter.load(prefs, "Filter_" + i); //NOI18N
        } catch (BackingStoreException bsE) {
            throw new IOException("Cannot load filter repository", bsE);
        }
        filters.add(filter);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:FilterRepository.java

示例2: loadTasks

import org.openide.util.NbPreferences; //导入依赖的package包/类
private void loadTasks() {
    Preferences pref = NbPreferences.forModule(TaskSchedulingManager.class);
    try {
        for (String key : pref.keys()) {
            if (key.startsWith(PREF_SCHEDULED)) {
                String repositoryId = key.substring(PREF_SCHEDULED.length());
                String tasks = pref.get(key, "");
                for (String taskId : tasks.split(SEP)) {
                    if (!taskId.isEmpty()) {
                        getRepositoryTasks(repositoryId).add(taskId);
                    }
                }
            }
        }
    } catch (BackingStoreException ex) {
        Logger.getLogger(TaskSchedulingManager.class.getName()).log(Level.INFO, null, ex);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:TaskSchedulingManager.java

示例3: M2RepositoryBrowser

import org.openide.util.NbPreferences; //导入依赖的package包/类
private M2RepositoryBrowser() {
    super(Children.create(new RootNodes(), true));
    setName(NAME);
    setDisplayName(CTL_M2RepositoryBrowserTopComponent2(RepositoryPreferences.isIndexRepositories() ? "" : CTL_M2RepositoriesDisabled()));
    setShortDescription(HINT_M2RepositoryBrowserTopComponent());
    setIconBaseWithExtension(ICON_PATH);
    NbPreferences.root().node("org/netbeans/modules/maven/nexus/indexing").addPreferenceChangeListener(new PreferenceChangeListener() {

        @Override
        public void preferenceChange(PreferenceChangeEvent evt) {
            if (RepositoryPreferences.PROP_INDEX.equals(evt.getKey())) {
                setDisplayName(CTL_M2RepositoryBrowserTopComponent2(RepositoryPreferences.isIndexRepositories() ? "" : CTL_M2RepositoriesDisabled()));
            }
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:M2RepositoryBrowser.java

示例4: registerDatabase

import org.openide.util.NbPreferences; //导入依赖的package包/类
/**
 * Registers in the Database Explorer the specified database
 * on the local Derby server.
 */
private  synchronized DatabaseConnection registerDatabase(String databaseName, String user, String schema, String password, boolean rememberPassword) throws DatabaseException {
    JDBCDriver drivers[] = JDBCDriverManager.getDefault().getDrivers(DerbyOptions.DRIVER_CLASS_NET);
    if (drivers.length == 0) {
        throw new IllegalStateException("The " + DerbyOptions.DRIVER_DISP_NAME_NET + " driver was not found"); // NOI18N
    }
    Preferences pref = NbPreferences.root().node(PATH_TO_DATABASE_PREFERENCES + databaseName);
    pref.put(USER_KEY, user == null ? "" : user);
    pref.put(SCHEMA_KEY, schema == null ? "" : schema);
    pref.put(PASSWORD_KEY, password == null ? "" : password);
    DatabaseConnection dbconn = DatabaseConnection.create(drivers[0], "jdbc:derby://localhost:" + RegisterDerby.getDefault().getPort() + "/" + databaseName, user, schema, password, rememberPassword); // NOI18N
    if (ConnectionManager.getDefault().getConnection(dbconn.getName()) == null) {
        ConnectionManager.getDefault().addConnection(dbconn);
    }
    notifyChange();
    return dbconn;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:DerbyDatabasesImpl.java

示例5: protectAgainstErrors

import org.openide.util.NbPreferences; //导入依赖的package包/类
private static boolean protectAgainstErrors(URL targetFolder, FileObject[][] sources, Object context) throws MalformedURLException {
    Preferences pref = NbPreferences.forModule(BuildArtifactMapperImpl.class).node(BuildArtifactMapperImpl.class.getSimpleName());

    if (!pref.getBoolean(UIProvider.ASK_BEFORE_RUN_WITH_ERRORS, true)) {
        return true;
    }
    
    sources(targetFolder, sources);
    
    for (FileObject file : sources[0]) {
        if (ErrorsCache.isInError(file, true) && !alreadyWarned.contains(context)) {
            UIProvider uip = Lookup.getDefault().lookup(UIProvider.class);
            if (uip == null || uip.warnContainsErrors(pref)) {
                alreadyWarned.add(context);
                return true;
            }
            return false;
        }
    }

    return true;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:BuildArtifactMapperImpl.java

示例6: getProperties

import org.openide.util.NbPreferences; //导入依赖的package包/类
/**
 * Returns all existing properties created in the given namespace.
 *
 * @param namespace string identifying the namespace
 * @return list of all existing properties created in the given namespace
 */
public List<InstanceProperties> getProperties(String namespace) {
    Preferences prefs = NbPreferences.forModule(InstancePropertiesManager.class);

    try {
        prefs = prefs.node(namespace);
        prefs.flush();

        List<InstanceProperties> allProperties = new ArrayList<InstanceProperties>();
        synchronized (this) {
            for (String id : prefs.childrenNames()) {
                Preferences child = prefs.node(id);
                InstanceProperties props = cache.get(child);
                if (props == null) {
                    props = new DefaultInstanceProperties(id, this, child);
                    cache.put(child, props);
                }
                allProperties.add(props);
            }
        }
        return allProperties;
    } catch (BackingStoreException ex) {
        LOGGER.log(Level.INFO, null, ex);
        throw new IllegalStateException(ex);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:32,代码来源:InstancePropertiesManager.java

示例7: FindDialogPanel

import org.openide.util.NbPreferences; //导入依赖的package包/类
/** Initializes the Form */
FindDialogPanel() {
    regExp = NbPreferences.forModule(Controller.class).getBoolean(KEY_REGEXP, false);
    matchCase = NbPreferences.forModule(Controller.class).getBoolean(KEY_MATCHCASE, false);
    initComponents();
    acceptButton = new JButton();
    Mnemonics.setLocalizedText(chbRegExp, NbBundle.getMessage(FindDialogPanel.class, "LBL_Use_RegExp"));
    Mnemonics.setLocalizedText(chbMatchCase, NbBundle.getMessage(FindDialogPanel.class, "LBL_Match_Case"));

    getAccessibleContext().setAccessibleName(NbBundle.getMessage(FindDialogPanel.class, "ACSN_Find"));
    getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(FindDialogPanel.class, "ACSD_Find"));
    findWhat.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(FindDialogPanel.class, "ACSD_Find_What"));
    acceptButton.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(FindDialogPanel.class, "ACSD_FindBTN"));

    findWhat.setModel(new DefaultComboBoxModel(history));
    findWhat.getEditor().addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            acceptButton.doClick();
        }
    });
    findWhatLabel.setFocusable(false);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:FindDialogPanel.java

示例8: getPreferredPlatform

import org.openide.util.NbPreferences; //导入依赖的package包/类
/**
 * Returns a preferred {@link JavaPlatform} for a new project.
 * @param platformType the platform type as specified by {@link Specification#getName()}
 * @return the preferred {@link JavaPlatform}
 */
@CheckForNull
public static JavaPlatform getPreferredPlatform(@NonNull final String platformType) {
    Parameters.notNull("platformType", platformType);   //NOI18N
    final String platformId = NbPreferences.forModule(PreferredProjectPlatform.class).get(
            MessageFormat.format(PREFERRED_PLATFORM, platformType),
            null);
    final JavaPlatformManager jpm = JavaPlatformManager.getDefault();
    if (platformId != null) {
        for (JavaPlatform jp : jpm.getInstalledPlatforms()) {
            if (platformId.equals(jp.getProperties().get(PLATFORM_ANT_NAME)) &&
                platformType.equals(jp.getSpecification().getName()) &&
                jp.isValid()) {
                return jp;
            }
        }
    }
    final JavaPlatform defaultPlatform = jpm.getDefaultPlatform();
    return platformType.equals(defaultPlatform.getSpecification().getName())?
           defaultPlatform:
           null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:PreferredProjectPlatform.java

示例9: windowClosed

import org.openide.util.NbPreferences; //导入依赖的package包/类
public void windowClosed(WindowEvent e) {
          optionsPanel.storeUserSize();
          // store location of dialog
          NbPreferences.forModule(OptionsDisplayerImpl.class).putInt("OptionsX", originalDialog.getX());//NOI18N
          NbPreferences.forModule(OptionsDisplayerImpl.class).putInt("OptionsY", originalDialog.getY());//NOI18N
   try {
FileUtil.getConfigRoot().getFileSystem().removeFileChangeListener(fcl);
   } catch (FileStateInvalidException ex) {
Exceptions.printStackTrace(ex);
   }
          if (optionsPanel.needsReinit()) {
              synchronized (lookupListener) {
                  descriptorRef = new WeakReference<DialogDescriptor>(null);
              }
          }
          if (this.originalDialog == dialog) {
              dialog = null;            
          }
          log.fine("Options Dialog - windowClosed"); //NOI18N
      }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:OptionsDisplayerImpl.java

示例10: GoalsPanel

import org.openide.util.NbPreferences; //导入依赖的package包/类
/** Creates new form POMInheritancePanel */
@Messages("HINT_Panel_hide=Click or press {0} to hide/show when the Navigator is active")
public GoalsPanel() {
    initComponents();
    treeView = (BeanTreeView)jScrollPane1;
    preferences = NbPreferences.forModule(GoalsPanel.class).node("goalNavigator");
    filtersPanel = new TapPanel();
    filtersPanel.setOrientation(TapPanel.DOWN);
    // tooltip
    KeyStroke toggleKey = KeyStroke.getKeyStroke(KeyEvent.VK_T,
            Toolkit.getDefaultToolkit().getMenuShortcutKeyMask());
    String keyText = Utilities.keyToString(toggleKey);
    filtersPanel.setToolTipText(HINT_Panel_hide(keyText)); //NOI18N

    JComponent buttons = createFilterButtons();
    buttons.setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 0));
    filtersPanel.add(buttons);
    if( "Aqua".equals(UIManager.getLookAndFeel().getID()) ) {
        filtersPanel.setBackground(UIManager.getColor("NbExplorerView.background"));//NOI18N
    } 

    add(filtersPanel, BorderLayout.SOUTH);
    
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:GoalsPanel.java

示例11: setDividerLocation

import org.openide.util.NbPreferences; //导入依赖的package包/类
public void setDividerLocation(int location) {
    if (!((CustomSplitterUI)getUI()).isCollapsed()) {
        savedDividerLocation = location;
        NbPreferences.forModule(CollapsibleSplitPane.class).
                putInt(PREF_LOCATION, savedDividerLocation);
    }
    super.setDividerLocation(location);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:CollapsibleSplitPane.java

示例12: clearCache

import org.openide.util.NbPreferences; //导入依赖的package包/类
@Override
protected void clearCache() {
    try {
        NbPreferences.forModule( RSSFeed.class ).remove( url2path( new URL(url1))) ;
        NbPreferences.forModule( RSSFeed.class ).remove( url2path( new URL(url2))) ;
    } catch( MalformedURLException mE ) {
        //ignore
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:CombinationRSSFeed.java

示例13: includeCanRenderPathFlag

import org.openide.util.NbPreferences; //导入依赖的package包/类
/**
 * If testedFlags has flag that according to preferences should be drawn,
 * draw it
 * @param flag
 * @return true if at least one of flags in testedFlag is set and preferences says that we should render it
 */
private synchronized boolean includeCanRenderPathFlag(int testedFlag) {
    for (MapFlag flag : MapFlag.values()) {
        // if tested flag has enabled the flag
        if ((flag.getFlag() & testedFlag) != 0) {
            // if it does, does user says we should render such paths
            boolean shouldRender = NbPreferences.forModule(TimelinePanel.class).getBoolean(flag.getPrefKey(), flag.getDefault());
            if (shouldRender) {
                return true;
            }
        }
    }
    return false;
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:20,代码来源:MapRenderer.java

示例14: storeRecentConnectionsList

import org.openide.util.NbPreferences; //导入依赖的package包/类
void storeRecentConnectionsList() {
    Preferences prefs = NbPreferences.forModule(ConnectionManager.class);
    synchronized (recentConnections) {
        for (int i = 0; i < recentConnections.size(); i++) {
            prefs.put(getConnectoinsHistoryKey(i), ExecutionEnvironmentFactory.toUniqueID(recentConnections.get(i)));
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:ConnectionManager.java

示例15: getJavaModulePreferenes

import org.openide.util.NbPreferences; //导入依赖的package包/类
private Preferences getJavaModulePreferenes() {
    try {
        ClassLoader cl = Lookup.getDefault().lookup(ClassLoader.class);
        Class accpClass = cl.loadClass("org.netbeans.modules.editor.java.AbstractCamelCasePosition"); // NOI18N
        if (accpClass == null) {
            return null;
        }
        return NbPreferences.forModule(accpClass);
    } catch (ClassNotFoundException ex) {
        return null;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:Model.java


注:本文中的org.openide.util.NbPreferences类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。