Java Code Examples for org.openide.util.NbBundle#Messages

The following examples show how to use org.openide.util.NbBundle#Messages . 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: ShelveChangesSupport.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
@NbBundle.Messages({
    "# {0} - invalid character", "ShelveChangesPanel.lblError.invalidCharacters=Patch name must not contain \"{0}\"."
})
public void actionPerformed (ActionEvent e) {
    String patchName = panel.txtPatchName.getText().trim();
    if (!patchName.isEmpty()) {
       Matcher m = p.matcher(patchName);
       if (m.find()) {
            setError(Bundle.ShelveChangesPanel_lblError_invalidCharacters(m.group(1)));
        } else if (!PatchStorage.getInstance().containsPatch(patchName)) {
            button.setEnabled(true);
        } else {
            setError(org.openide.util.NbBundle.getMessage(ShelveChangesPanel.class, "ShelveChangesPanel.lblError.text")); //NOI18N
            if (dialog.getHeight() < dialog.getPreferredSize().height || dialog.getWidth() < dialog.getPreferredSize().width) {
                dialog.pack();
            }
        }
    }
}
 
Example 2
Source File: ProjectPropertiesProblemProvider.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@NbBundle.Messages({
    "ProjectPropertiesProblemProvider.invalidIncludePath.title=Invalid Include Path",
    "ProjectPropertiesProblemProvider.invalidIncludePath.description=Some directories on project's Include Path are invalid."
})
void checkIncludePath(Collection<ProjectProblem> currentProblems) {
    // public first
    ProjectProblem projectProblem = checkIncludePath(PhpProjectProperties.INCLUDE_PATH);
    if (projectProblem != null) {
        currentProblems.add(projectProblem);
        return;
    }
    // private now
    projectProblem = checkIncludePath(PhpProjectProperties.PRIVATE_INCLUDE_PATH);
    if (projectProblem != null) {
        currentProblems.add(projectProblem);
    }
}
 
Example 3
Source File: WhiteListUpdater.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * A helper which which is here only for lack of better place - shows dialog whether
 * deployment should continue when whitelist violations are present in project.
 * @param p
 * @return 
 */
@NbBundle.Messages({
        "MSG_WhitelistViolations=Whitelist violations were detected in project being deployed. Are you sure you want to continue deployment?",
        "MSG_Dialog_Title=Continue deployment?"
})
public static boolean isWhitelistViolated(Project p) {
    SourceGroup[] sgs = ProjectUtils.getSources(p).getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
    if (sgs.length == 0) {
        return false;
    }
    Collection problems = WhiteListIndex.getDefault().
            getWhiteListViolations(sgs[0].getRootFolder(), null, "oracle");
    if (problems.size() > 0) {
        if (DialogDisplayer.getDefault().notify(
                new Confirmation(Bundle.MSG_WhitelistViolations(), Bundle.MSG_Dialog_Title(), NotifyDescriptor.YES_NO_OPTION)) != NotifyDescriptor.YES_OPTION) {
            return true;
        }
    }
    return false;
}
 
Example 4
Source File: MavenProjectCache.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@NbBundle.Messages({
    "LBL_Incomplete_Project_Name=<partially loaded Maven project>",
    "LBL_Incomplete_Project_Desc=Partially loaded Maven project; try building it."
})
public static MavenProject getFallbackProject(File projectFile) throws AssertionError {
    MavenProject newproject = new MavenProject();
    newproject.setGroupId("error");
    newproject.setArtifactId("error");
    newproject.setVersion("0");
    newproject.setPackaging("pom");
    newproject.setName(Bundle.LBL_Incomplete_Project_Name());
    newproject.setDescription(Bundle.LBL_Incomplete_Project_Desc());
    newproject.setFile(projectFile);
    return newproject;
}
 
Example 5
Source File: CreateBranch.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@NbBundle.Messages({
    "MSG_CreateBranch.errorBranchNameEmpty=Branch name cannot be empty",
    "MSG_CreateBranch.errorInvalidBranchName=Invalid branch name",
    "MSG_CreateBranch.errorBranchExists=A branch with the given name already exists.",
    "# {0} - branch name",
    "MSG_CreateBranch.errorParentExists=Cannot create branch under already existing \"{0}\""
})
private void validateName () {
    if (!internalChange) {
        nameModifiedByUser = true;
    }
    msgInvalidName = null;
    branchName = getBranchName();
    if (branchName.isEmpty()) {
        msgInvalidName = Bundle.MSG_CreateBranch_errorBranchNameEmpty();
    } else if (!GitUtils.isValidBranchName(branchName)) {
        msgInvalidName = Bundle.MSG_CreateBranch_errorInvalidBranchName();
    } else if (localBranchNames.contains(branchName)) {
        msgInvalidName = Bundle.MSG_CreateBranch_errorBranchExists();
    } else {
        for (String branch : localBranchNames) {
            if (branchName.startsWith(branch + "/") || branch.startsWith(branchName + "/")) {
                msgInvalidName = Bundle.MSG_CreateBranch_errorParentExists(branch);
                break;
            }
        }
    }
    validate();
}
 
Example 6
Source File: CustomizerMocha.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@NbBundle.Messages({"CustomizerMocha.mocha.dir.info=Full path of mocha installation dir (typically node_modules/mocha).",
"CustomizerMocha.timeout.info=Test-case timeout in milliseconds."})
private void init() {
    assert EventQueue.isDispatchThread();
    String mochaDir;
    // get saved mocha install dir if previously set from selenium/unit mocha preferences
    mochaDir = isSelenium ? MochaSeleniumPreferences.getMochaDir(project) : MochaJSPreferences.getMochaDir(project);
    if(mochaDir == null) {
        // that did not work so try to get saved mocha install dir from unit/selenium mocha preferences
        mochaDir = isSelenium ? MochaJSPreferences.getMochaDir(project) : MochaSeleniumPreferences.getMochaDir(project);
    }
    if(mochaDir == null) { // mocha dir not set yet, try searching for it in project's local node_modules dir
        String dir = new File(FileUtil.toFile(project.getProjectDirectory()), "node_modules/mocha").getAbsolutePath();
        ValidationResult result = new MochaPreferencesValidator()
            .validateMochaInstallFolder(dir)
            .getResult();
        if(result.isFaultless()) { // mocha is installed in project's local node_modules dir
            mochaDir = dir;
            autoDiscovered = true;
        }
    }
    mochaDirTextField.setText(mochaDir);
    mochaDirInfoLabel.setText(Bundle.CustomizerMocha_mocha_dir_info());
    timeoutSpinner.setModel(timeoutModel);
    timeout = isSelenium ? MochaSeleniumPreferences.getTimeout(project) : MochaJSPreferences.getTimeout(project);
    timeoutModel.setValue(timeout);
    timeoutInfoLabel.setText(Bundle.CustomizerMocha_timeout_info());
    if(isSelenium) {
        autowatchCheckBox.setVisible(false);
    } else {
        autowatchCheckBox.setSelected(MochaJSPreferences.isAutoWatch(project));
    }
    // listeners
    addListeners();
    // initial validation
    validateData();
}
 
Example 7
Source File: RemoteStyleSheetCache.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
@NbBundle.Messages({
    "RemoteStyleSheetCache.generatedStylesheet=Generated Style Sheet" // NOI18N
})
public String getName() {
    String name = getSpecifiedName();
    if (name == null || name.isEmpty()) {
        name = Bundle.RemoteStyleSheetCache_generatedStylesheet();
    }
    return name;
}
 
Example 8
Source File: ExternalExecutableValidator.java    From minifierbeans with Apache License 2.0 5 votes vote down vote up
@NbBundle.Messages({
    "# {0} - source",
    "ExternalExecutableValidator.validateFile.missing={0} must be selected.",
    "# {0} - source",
    "ExternalExecutableValidator.validateFile.notAbsolute={0} must be an absolute path.",
    "# {0} - source",
    "ExternalExecutableValidator.validateFile.notFile={0} must be a valid file.",
    "# {0} - source",
    "ExternalExecutableValidator.validateFile.notReadable={0} is not readable.",
    "# {0} - source",
    "ExternalExecutableValidator.validateFile.notWritable={0} is not writable."
})
@CheckForNull
private static String validateFile(String source, String filePath, boolean writable) {
    if (filePath == null
            || filePath.trim().isEmpty()) {
        return Bundle.ExternalExecutableValidator_validateFile_missing(source);
    }

    File file = new File(filePath);
    if (!file.isAbsolute()) {
        return Bundle.ExternalExecutableValidator_validateFile_notAbsolute(source);
    } else if (!file.isFile()) {
        return Bundle.ExternalExecutableValidator_validateFile_notFile(source);
    } else if (!file.canRead()) {
        return Bundle.ExternalExecutableValidator_validateFile_notReadable(source);
    } else if (writable && !file.canWrite()) {
        return Bundle.ExternalExecutableValidator_validateFile_notWritable(source);
    }
    return null;
}
 
Example 9
Source File: SourcesPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@NbBundle.Messages("SourcesPanel.browse.testSeleniumFolder=Select Selenium Tests")
private void testSeleniumFolderBrowseButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_testSeleniumFolderBrowseButtonActionPerformed
    String filePath = browseFolder(Bundle.SourcesPanel_browse_testSeleniumFolder(), getTestSeleniumFolder());
    if (filePath != null) {
        setTestSeleniumFolder(filePath);
    }
}
 
Example 10
Source File: AtoumCustomizer.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@NbBundle.Messages("AtoumCustomizer.name=atoum")
@Override
public ProjectCustomizer.Category createCategory(Lookup context) {
    return ProjectCustomizer.Category.create(
            IDENTIFIER,
            Bundle.AtoumCustomizer_name(),
            null,
            (ProjectCustomizer.Category[]) null);
}
 
Example 11
Source File: InternalWebServer.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@NbBundle.Messages({
    "# {0} - project name",
    "InternalWebServer.stopping=Stopping PHP built-in web server for project {0}..."
})
@SuppressWarnings("SleepWhileHoldingLock")
private static boolean ensureServerStopped(InternalWebServer instance) {
    assert !EventQueue.isDispatchThread();
    ProgressHandle progressHandle = ProgressHandle.createHandle(Bundle.InternalWebServer_stopping(instance.project.getName()));
    try {
        progressHandle.start();
        // stop server
        instance.stop();
        // wait for shutdown
        RunConfigInternal runConfig = RunConfigInternal.forProject(instance.project);
        String host = runConfig.getHostname();
        int port = Integer.parseInt(runConfig.getPort());
        for (int i = 0; i < 20; ++i) {
            try {
                Socket socket = new Socket(host, port);
                socket.close();
                Thread.sleep(200);
            } catch (InterruptedException ex) {
                Thread.currentThread().interrupt();
            } catch (UnknownHostException ex) {
                return true;
            } catch (IOException ex) {
                return true;
            }
        }
        return false;
    } finally {
        progressHandle.finish();
    }
}
 
Example 12
Source File: CleanAction.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@NbBundle.Messages("CleanAction.name=Clean")
@Override
protected String getName() {
    return Bundle.CleanAction_name();
}
 
Example 13
Source File: ConvertVisibilitySuggestion.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
@NbBundle.Messages("ConvertVisibilitySuggestion.Description=Convert the visibility of a property, a method, or a constant. Please convert it carefully. (e.g. from public to private)")
public String getDescription() {
    return Bundle.ConvertVisibilitySuggestion_Description();
}
 
Example 14
Source File: UpdateAutoloaderNoDevAction.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@NbBundle.Messages("UpdateAutoloaderNoDevAction.name=Update Autoloader (no-dev)")
@Override
protected String getName() {
    return Bundle.UpdateAutoloaderNoDevAction_name();
}
 
Example 15
Source File: BuildImageWizard.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@NbBundle.Messages("LBL_Stop=Stop")
public StopAction() {
    setEnabled(false); // initially, until ready
    putValue(Action.SMALL_ICON, ImageUtilities.loadImageIcon("org/netbeans/modules/docker/ui/resources/action_stop.png", false)); // NOI18N
    putValue(Action.SHORT_DESCRIPTION, Bundle.LBL_Stop());
}
 
Example 16
Source File: TwigCompletionProposal.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
@NbBundle.Messages("TagRhs=Tag")
public String getRhsHtml(HtmlFormatter formatter) {
    return Bundle.TagRhs();
}
 
Example 17
Source File: PHP55UnhandledError.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
@NbBundle.Messages("PHP55VersionErrorHintDispName=Language feature not compatible with PHP version indicated in project settings")
public String getDisplayName() {
    return Bundle.PHP55VersionErrorHintDispName();
}
 
Example 18
Source File: InspectContainerAction.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@NbBundle.Messages("LBL_InspectAction=Inspect")
@Override
public String getName() {
    return Bundle.LBL_InspectAction();
}
 
Example 19
Source File: ShowExecutionPanel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@NbBundle.Messages("ACT_GOTO_Output=Go to Build Output")
public GotoOutputAction(ExecutionEventObject.Tree item) {
    putValue(NAME, ACT_GOTO_Output());
    this.item = item;
}
 
Example 20
Source File: KarmaChildrenList.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@NbBundle.Messages("CustomizeKarmaAction.name=Properties")
@Override
public String getName() {
    return Bundle.CustomizeKarmaAction_name();
}