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


Java Places.getUserDirectory方法代码示例

本文整理汇总了Java中org.openide.modules.Places.getUserDirectory方法的典型用法代码示例。如果您正苦于以下问题:Java Places.getUserDirectory方法的具体用法?Java Places.getUserDirectory怎么用?Java Places.getUserDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openide.modules.Places的用法示例。


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

示例1: discardCachesImpl

import org.openide.modules.Places; //导入方法依赖的package包/类
private static void discardCachesImpl(AtomicLong al) {
    File user = Places.getUserDirectory();
    long now = System.currentTimeMillis();
    if (user != null) {
        File f = new File(user, ".lastModified");
        if (f.exists()) {
            f.setLastModified(now);
        } else {
            f.getParentFile().mkdirs();
            try {
                f.createNewFile();
            } catch (IOException ex) {
                LOG.log(Level.WARNING, "Cannot create " + f, ex);
            }
        }
    }
    if (al != null) {
        al.set(now);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:Stamps.java

示例2: markReadyForRestart

import org.openide.modules.Places; //导入方法依赖的package包/类
/** Creates files that instruct the native launcher to perform restart as
 * soon as the Java process finishes. 
 * 
 * @since 1.45
 * @throws UnsupportedOperationException some environments (like WebStart)
 *   do not support restart and may throw an exception to indicate that
 */
static void markReadyForRestart() throws UnsupportedOperationException {
    String classLoaderName = TopSecurityManager.class.getClassLoader().getClass().getName();
    if (!classLoaderName.endsWith(".Launcher$AppClassLoader") && !classLoaderName.endsWith(".ClassLoaders$AppClassLoader")) {   // NOI18N
        throw new UnsupportedOperationException("not running in regular module system, cannot restart"); // NOI18N
    }
    File userdir = Places.getUserDirectory();
    if (userdir == null) {
        throw new UnsupportedOperationException("no userdir"); // NOI18N
    }
    File restartFile = new File(userdir, "var/restart"); // NOI18N
    if (!restartFile.exists()) {
        try {
            restartFile.createNewFile();
        } catch (IOException x) {
            throw new UnsupportedOperationException(x);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:ModuleLifecycleManager.java

示例3: defaultHandler

import org.openide.modules.Places; //导入方法依赖的package包/类
private static synchronized Handler defaultHandler() {
    if (defaultHandler != null) return defaultHandler;

    File home = Places.getUserDirectory();
    if (home != null && !CLIOptions.noLogging) {
        File dir = new File(new File(home, "var"), "log");
        dir.mkdirs ();

        Handler h = NbLogging.createMessagesHandler(dir);
        defaultHandler = NbLogging.createDispatchHandler(h, 5000);
    }

    if (defaultHandler == null) {
        defaultHandler = streamHandler();
        disabledConsole = true;
    }
    return defaultHandler;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:TopLogging.java

示例4: goMinusR

import org.openide.modules.Places; //导入方法依赖的package包/类
/** Tries to set permissions on preferences storage file to -rw------- */
public static void goMinusR(Preferences p) {
    File props = new File(Places.getUserDirectory(), ("config/Preferences" + p.absolutePath()).replace('/', File.separatorChar) + ".properties");
    if (props.isFile()) {
        props.setReadable(false, false); // seems to be necessary, not sure why
        props.setReadable(true, true);
        LOG.log(Level.FINE, "chmod go-r {0}", props);
    } else {
        LOG.log(Level.FINE, "no such file to chmod: {0}", props);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:Utils.java

示例5: createAttachment

import org.openide.modules.Places; //导入方法依赖的package包/类
private void createAttachment (AttachmentInfo newAttachment) {
    AttachmentPanel attachment = new AttachmentPanel(nbCallback);
    attachment.setBackground(UIUtils.getSectionPanelBackground());
    horizontalGroup.addComponent(attachment, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE);
    verticalGroup.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED);
    verticalGroup.addComponent(attachment, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE);
    if (noneLabel.isVisible()) {
        noneLabel.setVisible(false);
        switchHelper();
        updateButtonText(false);
    }
    attachment.addPropertyChangeListener(getDeletedListener());
    
    if (newAttachment != null) {
        attachment.setAttachment(newAttachment.getFile(), newAttachment.getDescription(),
                newAttachment.getContentType(), newAttachment.isPatch());
    }
    if(nbCallback != null) {
        File f = new File(Places.getUserDirectory(), nbCallback.getLogFilePath()); 
        if(f.exists()) {
            attachment.setAttachment(f, nbCallback.getLogFileDescription(), nbCallback.getLogFileContentType(), false); // NOI18N
        }
        attachment.browseButton.setEnabled(false);
        attachment.fileField.setEnabled(false);
        attachment.fileTypeCombo.setEnabled(false);
        attachment.patchChoice.setEnabled(false);
    } else {
        attachment.viewButton.setVisible(false);
    }

    newAttachments.add(attachment);
    UIUtils.keepFocusedComponentVisible(attachment, parentPanel);
    revalidate();
    attachment.addChangeListener(getChangeListener());
    attachment.fileField.requestFocus();
    if (nbCallback != null) {
        supp.fireChange();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:40,代码来源:AttachmentsPanel.java

示例6: getStorageLocation

import org.openide.modules.Places; //导入方法依赖的package包/类
private static File getStorageLocation () {
    String explicitLocation = System.getProperty(PROP_EXPLICIT_LOCATION, ""); //NOI18N
    if (explicitLocation.isEmpty()) {
        File userDir = Places.getUserDirectory();
        return new File(new File(new File(userDir, "var"), "versioning"), "patch-storage"); //NOI18N
    } else {
        return new File(explicitLocation);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:PatchStorage.java

示例7: actionPerformed

import org.openide.modules.Places; //导入方法依赖的package包/类
@Messages("MSG_ShortLogTab_name=IDE Log")
@Override public void actionPerformed(ActionEvent evt) {
    File userDir = Places.getUserDirectory();
    if (userDir == null) {
        return;
    }
    File f = new File(userDir, "/var/log/messages.log");
    LogViewerSupport p = new LogViewerSupport(f, MSG_ShortLogTab_name());
    try {
        p.showLogViewer();
    } catch (IOException e) {
        Logger.getLogger(LogAction.class.getName()).log(Level.INFO, "Showing IDE log action failed", e);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:LogAction.java

示例8: userBuildProperties

import org.openide.modules.Places; //导入方法依赖的package包/类
/**
 * Location in user directory of per-user global properties.
 * May be null if <code>netbeans.user</code> is not set.
 */
static File userBuildProperties() {
    File nbuser = Places.getUserDirectory();
    if (nbuser != null) {
        return FileUtil.normalizeFile(new File(nbuser, "build.properties")); // NOI18N
    } else {
        return null;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:PropertyUtils.java

示例9: logsDirectory

import org.openide.modules.Places; //导入方法依赖的package包/类
static File logsDirectory(){
    
    File userDir = Places.getUserDirectory();
    if (userDir != null) {
        return new File(new File(userDir, "var"), "log");                   // NOI18N
    } else {
        return null;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:Installer.java

示例10: getMessagesLog

import org.openide.modules.Places; //导入方法依赖的package包/类
private static File getMessagesLog(boolean fromLastRun) {
    File userDir = Places.getUserDirectory();
    if (userDir == null) {
        return null;
    }
    File log = null;
    if (fromLastRun) {
        log = new File(userDir, NbBundle.getMessage(Installer.class, "LOG_FILE_LAST"));
    }
    if (log == null || !log.exists()) {
        log = new File(userDir, NbBundle.getMessage(Installer.class, "LOG_FILE"));
    }
    return log;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:Installer.java

示例11: getUnversionedFolders

import org.openide.modules.Places; //导入方法依赖的package包/类
public static String[] getUnversionedFolders () {
    if (unversionedFolders == null) {
        String[] files;
        try {
            String uf = VersioningSupport.getPreferences().get("unversionedFolders", ""); //NOI18N
            String ufProp = System.getProperty("versioning.unversionedFolders", ""); //NOI18N
            StringBuilder sb = new StringBuilder(uf);
            File nbUserdir = Places.getUserDirectory();
            if (nbUserdir != null && !isVersionUserdir()) { 
                if (sb.length() > 0) {
                    sb.append(';');
                }
                sb.append(nbUserdir.getAbsolutePath());
            }
            if (!ufProp.isEmpty()) {
                if (sb.length() > 0) {
                    sb.append(';');
                }
                sb.append(ufProp);
            }
            if (sb.length() == 0) {
                files = new String[0];
            } else {
                String [] paths = sb.toString().split("\\;"); //NOI18N
                files = new String[paths.length];
                int idx = 0;
                for (String path : paths) {
                    files[idx++] = path;
                }
            }
        } catch (Exception e) {
            files = new String[0];
            Logger.getLogger(Utils.class.getName()).log(Level.INFO, e.getMessage(), e);
        }
        unversionedFolders = files;
    }
    return unversionedFolders;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:39,代码来源:Utils.java

示例12: getStorageRootFile

import org.openide.modules.Places; //导入方法依赖的package包/类
private File getStorageRootFile() {
    return new File(new File(Places.getUserDirectory(), "config"), "issue-tracking");         // NOI18N
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:IssueSettingsStorage.java

示例13: updateUserBuildPropertiesRef

import org.openide.modules.Places; //导入方法依赖的package包/类
private void updateUserBuildPropertiesRef() {
    final EditableProperties ep = updateHelper.getProperties(AntProjectHelper.PRIVATE_PROPERTIES_PATH);
    final File buildProperties = new File(Places.getUserDirectory(), "build.properties"); // NOI18N
    ep.setProperty("user.properties.file", buildProperties.getAbsolutePath()); //NOI18N
    updateHelper.putProperties(AntProjectHelper.PRIVATE_PROPERTIES_PATH, ep);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:ProjectHooks.java

示例14: getStorageRootFile

import org.openide.modules.Places; //导入方法依赖的package包/类
static File getStorageRootFile() {
    return new File(new File(Places.getUserDirectory(), "var"), "filehistory"); // NOI18N
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:LocalHistoryStoreImpl.java

示例15: showImportDialog

import org.openide.modules.Places; //导入方法依赖的package包/类
@NbBundle.Messages({
    "OPT_RestartAfterImport=false"
})
/** Shows panel for import of options. */
public static void showImportDialog() {
    LOGGER.fine("showImportDialog");  //NOI18N
    OptionsChooserPanel optionsChooserPanel = new OptionsChooserPanel();
    optionsChooserPanel.txtFile.setEditable(false);
    Mnemonics.setLocalizedText(optionsChooserPanel.lblFile, NbBundle.getMessage(OptionsChooserPanel.class, "OptionsChooserPanel.import.lblFile.text"));
    Mnemonics.setLocalizedText(optionsChooserPanel.lblHint, NbBundle.getMessage(OptionsChooserPanel.class, "OptionsChooserPanel.import.lblHint.text"));
    optionsChooserPanel.panelType = PanelType.IMPORT;

    DialogDescriptor dd = new DialogDescriptor(
            optionsChooserPanel,
            NbBundle.getMessage(OptionsChooserPanel.class, "OptionsChooserPanel.import.title"),
            true,
            new Object[]{DialogDescriptor.OK_OPTION, DialogDescriptor.CANCEL_OPTION},
            DialogDescriptor.OK_OPTION,
            DialogDescriptor.DEFAULT_ALIGN,
            null,
            null);
    dd.createNotificationLineSupport();
    dd.setValid(false);
    boolean ok;
    final boolean willRestart = "true".equals(Bundle.OPT_RestartAfterImport()); // NOI18N
    final ImportConfirmationPanel confirmationPanel = new ImportConfirmationPanel();
    dd.setButtonListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (willRestart && e.getSource() == DialogDescriptor.OK_OPTION) {
                // show confirmation dialog when user click OK
                confirmationPanel.showConfirmation();
            }
        }
    });
    optionsChooserPanel.setDialogDescriptor(dd);
    DialogDisplayer.getDefault().createDialog(dd).setVisible(true);
    ok = DialogDescriptor.OK_OPTION.equals(dd.getValue());
    if (willRestart) {
        if (!confirmationPanel.confirmed()) {
            LOGGER.fine("Import canceled.");  //NOI18N
            ok = false;
        }
    }

    if (ok) {
        // do import
        File targetUserdir = Places.getUserDirectory();
        try {
            optionsChooserPanel.getOptionsExportModel().doImport(targetUserdir);
        } catch (IOException ioe) {
            // report exception and return if import failed
            Exceptions.attachLocalizedMessage(ioe,
                    NbBundle.getMessage(OptionsChooserPanel.class, "OptionsChooserPanel.import.error"));
            LOGGER.log(Level.SEVERE, ioe.getMessage(), ioe);
            return;
        }
        LOGGER.fine("Import finished.");  //NOI18N
        if (willRestart) { // NOI18N
            // restart IDE
            LifecycleManager.getDefault().markForRestart();
            LifecycleManager.getDefault().exit();
        }
        try {
            FileUtil.getConfigRoot().getFileSystem().refresh(true);
        } catch (FileStateInvalidException ex) {
            Exceptions.printStackTrace(ex);
        }
        Action reload = Actions.forID("Window", "org.netbeans.core.windows.actions.ReloadWindowsAction");
        if (reload != null) {
            reload.actionPerformed(new ActionEvent(optionsChooserPanel, 0, ""));
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:75,代码来源:OptionsChooserPanel.java


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