Java Code Examples for org.netbeans.api.java.platform.JavaPlatform#getDisplayName()

The following examples show how to use org.netbeans.api.java.platform.JavaPlatform#getDisplayName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FixPlatform.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public Component getListCellRendererComponent(
        @NonNull final JList<?> list,
        @NonNull Object value,
        final int index,
        final boolean isSelected,
        final boolean cellHasFocus) {
    if (value instanceof JavaPlatform) {
        final JavaPlatform jp = (JavaPlatform) value;
        value = jp.getDisplayName();
        if (jp.getInstallFolders().isEmpty()) {
            value = String.format(
                    "<html><font color=\"%s\">%s</font>", //NOI18N
                    getHtmlColor(getErrorForeground()),
                    value);
        }

    }
    return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
}
 
Example 2
Source File: PlatformNode.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public String getDisplayName() {
    JavaPlatform plat = pp.getPlatform();
    String name;
    if (plat != null) {
        name = plat.getDisplayName();
    } else {
        String platformId = pp.getPlatformID();
        if (platformId == null) {
            name = NbBundle.getMessage(PlatformNode.class,"TXT_BrokenPlatform");
        } else {
            name = MessageFormat.format(NbBundle.getMessage(PlatformNode.class,"FMT_BrokenPlatform"), new Object[] {platformId});
        }
    }
    return name;
}
 
Example 3
Source File: BootCPNodeFactory.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public String getDisplayName() {
    final Pair<String, JavaPlatform> platHolder = pp.getPlatform();
    if (platHolder == null) {
        return Bundle.TXT_UnknownPlatform();
    }
    String name;
    final JavaPlatform jp = platHolder.second();
    if (jp != null) {
        if (jp.isValid()) {
            name = jp.getDisplayName();
        } else {
            name = Bundle.FMT_BrokenPlatform(jp.getDisplayName());
        }
    } else {
        String platformId = platHolder.first();
        if (platformId == null) {
            name = Bundle.TXT_BrokenPlatform();
        } else {
            name = Bundle.FMT_BrokenPlatform(platformId);
        }
    }
    return name;
}
 
Example 4
Source File: PlatformNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public String getDisplayName () {
    final Pair<String,JavaPlatform> platHolder = pp.getPlatform();
    if (platHolder == null) {
        return NbBundle.getMessage(PlatformNode.class, "TXT_UnknownPlatform");
    }
    String name;
    final JavaPlatform jp = platHolder.second();
    if (jp != null) {
        if (jp.isValid()) {
            name = jp.getDisplayName();
        } else {
            name = MessageFormat.format(
                    NbBundle.getMessage(PlatformNode.class,"FMT_BrokenPlatform"),
                    new Object[] {
                        jp.getDisplayName()
                    });
        }
    } else {
        String platformId = platHolder.first();
        if (platformId == null) {
            name = NbBundle.getMessage(PlatformNode.class,"TXT_BrokenPlatform");
        } else {
            name = MessageFormat.format(
                    NbBundle.getMessage(PlatformNode.class,"FMT_BrokenPlatform"),
                    new Object[] {
                        platformId
                    });
        }
    }
    return name;
}
 
Example 5
Source File: NashornPlatform.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void setPlatform(JavaPlatform selectedPlatform) {
    if (selectedPlatform == null) {
        Settings.getPreferences().remove(Settings.PREF_NASHORN_PLATFORM_DISPLAY_NAME);
    } else {
        if (!isJsJvmPlatform(selectedPlatform)) {
            throw new IllegalArgumentException(selectedPlatform.getDisplayName());
        }
        Settings.getPreferences().put(Settings.PREF_NASHORN_PLATFORM_DISPLAY_NAME,
                                      selectedPlatform.getDisplayName());
    }
    nashornPlatform = selectedPlatform;
}
 
Example 6
Source File: JavaPlatformTreeElement.java    From netbeans with Apache License 2.0 4 votes vote down vote up
JavaPlatformTreeElement(JavaPlatform platform) {
    this.platform = platform;

    icon = new ImageIcon(ImageUtilities.loadImage(PLATFORM_ICON));
    displayName = platform.getDisplayName();
}
 
Example 7
Source File: CustomizerRun.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private PlatformKey(@NonNull final JavaPlatform platform) {
    this.displayName = platform.getDisplayName();
    this.platform = platform;
}
 
Example 8
Source File: JavaSEPlatformPanel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/**
 * Display GlassFish Java SE selector to allow switch Java SE used
 * to run GlassFish.
 * <p/>
 * Selected Java SE is stored in server instance properties and returned
 * by this method. Properties are persisted.
 * <p/>
 * @param instance GlassFish server instance to be started.
 * @param javaHome Java SE home currently selected.
 */
public static FileObject selectServerSEPlatform(            
       final  GlassfishInstance instance, final File javaHome) {
    FileObject selectedJavaHome = null;
    // Matching Java SE home installed platform if exists.
    JavaPlatform platform = JavaUtils.findInstalledPlatform(javaHome);
    String platformName = platform != null
            ? platform.getDisplayName() : javaHome.getAbsolutePath();
    String message = NbBundle.getMessage(
            JavaSEPlatformPanel.class,
            "JavaSEPlatformPanel.warning", platformName);
    String title = NbBundle.getMessage(
            JavaSEPlatformPanel.class,
            "JavaSEPlatformPanel.title", platformName);
    NotifyDescriptor notifyDescriptor = new NotifyDescriptor(
            null, title, NotifyDescriptor.OK_CANCEL_OPTION,
            NotifyDescriptor.PLAIN_MESSAGE, null, null);
    JavaSEPlatformPanel panel = new JavaSEPlatformPanel(
            notifyDescriptor, instance, message);
    Object button = DialogDisplayer.getDefault().notify(notifyDescriptor);
    if (button == CANCEL_OPTION) {
        return selectedJavaHome;
    }
    JavaPlatform selectedPlatform = panel.javaPlatform();
    if (selectedPlatform != null) {
        Iterator<FileObject> platformIterator
                = selectedPlatform.getInstallFolders().iterator();
        if (platformIterator.hasNext()) {
            selectedJavaHome = platformIterator.next();
        }
    }
    if (selectedJavaHome != null && panel.updateProperties()) {
        instance.setJavaHome(panel.isJavaPlatformDefault() ? null
                : FileUtil.toFile(selectedJavaHome).getAbsolutePath());
        try {
            GlassfishInstance.writeInstanceToFile(instance);
        } catch(IOException ex) {
            LOGGER.log(Level.INFO,
                    "Could not store GlassFish server attributes", ex);
        }
    }
    return selectedJavaHome;
}
 
Example 9
Source File: JFXRunPanel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private PlatformKey(@NonNull final JavaPlatform platform) {
    this.displayName = platform.getDisplayName();
    this.platform = platform;
}