@Messages({ "CosChecker.no_test_cos.title=Not using Compile on Save", "CosChecker.no_test_cos.details=Compile on Save mode can speed up single test execution for many projects." }) static void warnNoTestCoS(RunConfig config) { if (warnedNoCoS) { return; } final Project project = config.getProject(); if (project == null) { return; } final Notification n = NotificationDisplayer.getDefault().notify(CosChecker_no_test_cos_title(), ImageUtilities.loadImageIcon(SUGGESTION, true), CosChecker_no_test_cos_details(), new ActionListener() { @Override public void actionPerformed(ActionEvent e) { showCompilePanel(project); } }, NotificationDisplayer.Priority.LOW); RequestProcessor.getDefault().post(new Runnable() { @Override public void run() { n.clear(); } }, 15 * 1000); warnedNoCoS = true; }
@Override @Messages("LBL_Site_Pages=Project Site") public String getDisplayName() { if (isTopLevelNode) { String s = LBL_Site_Pages(); DataObject dob = getOriginal().getLookup().lookup(DataObject.class); FileObject file = dob.getPrimaryFile(); try { s = file.getFileSystem().getDecorator().annotateName(s, Collections.singleton(file)); } catch (FileStateInvalidException e) { ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e); } return s; } return getOriginal().getDisplayName(); }
@Messages({"writePermission=You don't have permission to install JUnit Library into the installation directory which is recommended.", "showDetails=Show details"}) private static void notifyWarning(final OperationContainer<InstallSupport> oc, final UpdateElement jUnitElement, final UpdateUnit jUnitLib) { // lack of privileges for writing ActionListener onMouseClickAction = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Runnable r = new Runnable() { @Override public void run() { try { install(oc, jUnitElement, jUnitLib, true); } catch (OperationException ex) { LOG.log(Level.INFO, "While installing " + jUnitLib + " thrown " + ex, ex); } } }; showWritePermissionDialog(r); } }; String title = writePermission(); String description = showDetails(); NotificationDisplayer.getDefault().notify(title, ImageUtilities.loadImageIcon("org/netbeans/modules/autoupdate/pluginimporter/resources/warning.gif", false), // NOI18N description, onMouseClickAction, NotificationDisplayer.Priority.HIGH, NotificationDisplayer.Category.WARNING); }
@Messages({"# {0} - server label", "# {1} - job name", "search_response=Hudson job {1} on {0}"}) private void work(String text, SearchResponse response) { for (final HudsonInstance instance : HudsonManager.getAllInstances()) { for (HudsonJob job : instance.getJobs()) { final String name = job.getName(); // XXX could also search for text in instance name, and/or Maven modules if (name.toLowerCase(Locale.ENGLISH).contains(text.toLowerCase(Locale.ENGLISH))) { if (!response.addResult(new Runnable() { @Override public void run() { UI.selectNode(instance.getUrl(), name); } }, Bundle.search_response(instance.getName(), name))) { return; } } } } }
/** * Shows libraries customizer displaying all currently open library managers. * @return true if user pressed OK and libraries were sucessfully modified */ @Messages("TXT_LibrariesManager=Ant Library Manager") private static boolean showCustomizer () { AllLibrariesCustomizer customizer = new AllLibrariesCustomizer(); DialogDescriptor descriptor = new DialogDescriptor(customizer, TXT_LibrariesManager()); Dialog dlg = DialogDisplayer.getDefault().createDialog(descriptor); try { dlg.setVisible(true); if (descriptor.getValue() == DialogDescriptor.OK_OPTION) { return customizer.apply(); } else { return false; } } finally { dlg.dispose(); } }
@Messages({ "LBL_FormattingQuestion=Recursively format the selected files and folders?", "LBL_FormattingInProgress=Formatting:" }) public ConfirmationPanel(ProgressHandle handle) { initComponents(); setLayout(new CardLayout()); add(new JLabel(Bundle.LBL_FormattingQuestion()), PANEL_QUESTION); JPanel progress = new JPanel(new BorderLayout()); JLabel inProgressLabel = new JLabel(Bundle.LBL_FormattingInProgress()); inProgressLabel.setBorder(new EmptyBorder(0, 0, 6, 0)); progress.add(inProgressLabel, BorderLayout.NORTH); progress.add(ProgressHandleFactory.createProgressComponent(handle), BorderLayout.CENTER); add(progress, PANEL_PROGRESS); ((CardLayout) getLayout()).show(this, PANEL_QUESTION); }
@Hint(displayName="#DN_lambda2Class", description="#DESC_lambda2Class", category="suggestions", hintKind=Hint.Kind.ACTION, minSourceVersion = "8") @Messages({ "DN_lambda2Class=Convert Lambda Expression to Anonymous Innerclass", "DESC_lambda2Class=Converts lambda expressions to anonymous inner classes", "ERR_lambda2Class=Anonymous class can be used" }) @TriggerTreeKind(Kind.LAMBDA_EXPRESSION) public static ErrorDescription lambda2Class(HintContext ctx) { TypeMirror samType = ctx.getInfo().getTrees().getTypeMirror(ctx.getPath()); if (samType == null || samType.getKind() != TypeKind.DECLARED) { return null; } return ErrorDescriptionFactory.forTree(ctx, ctx.getPath(), Bundle.ERR_lambda2Class(), new Lambda2Anonymous(ctx.getInfo(), ctx.getPath()).toEditorFix()); }
@Messages({ "# {0} - number of bytes", "TXT_Bytes={0} bytes", "# {0} - number of kilo bytes", "TXT_kb={0} kb", "# {0} - number of mega bytes", "TXT_Mb={0} Mb" }) private String computeSize(long size) { long kbytes = size / 1024; if (kbytes == 0) { return TXT_Bytes(size); } long mbytes = kbytes / 1024; if (mbytes == 0) { return TXT_kb(kbytes); } return TXT_Mb(mbytes); }
@Messages({"LBL_RunAllAnalyzers=All Analyzers", "# {0} - the analyzer that should be run", "LBL_RunAnalyzer={0}"}) @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { if (value == null) { value = Bundle.LBL_RunAllAnalyzers(); } else if (value instanceof AnalyzerFactory) { value = Bundle.LBL_RunAnalyzer(SPIAccessor.ACCESSOR.getAnalyzerDisplayName((AnalyzerFactory) value)); } else if (value instanceof Configuration) { value = ((Configuration) value).getDisplayName(); } else if (value instanceof String) { setFont(getFont().deriveFont(Font.ITALIC)); setText((String) value); setEnabled(false); setBackground(list.getBackground()); setForeground(UIManager.getColor("Label.disabledForeground")); return this; } if (index == list.getModel().getSize()-5 && list.getModel() instanceof ConfigurationsComboModel && ((ConfigurationsComboModel) list.getModel()).canModify()) { setBorder(new Separator(list.getForeground())); } else { setBorder(null); } return super.getListCellRendererComponent(list, (indent ? " " : "") + value, index, isSelected, cellHasFocus); }
@Messages({"# {0} - module display name", "CTL_EditModuleDependencyTitle=Edit \"{0}\" Dependency"}) public @Override void actionPerformed(ActionEvent ev) { final EditTestDependencyPanel editTestPanel = new EditTestDependencyPanel(testDep); DialogDescriptor descriptor = new DialogDescriptor(editTestPanel, CTL_EditModuleDependencyTitle(testDep.getModule().getLocalizedName())); descriptor.setHelpCtx(new HelpCtx("org.netbeans.modules.apisupport.project.ui.customizer.EditTestDependencyPanel")); Dialog d = DialogDisplayer.getDefault().createDialog(descriptor); d.setVisible(true); if (descriptor.getValue().equals(DialogDescriptor.OK_OPTION)) { TestModuleDependency editedDep = editTestPanel.getEditedDependency(); try { ProjectXMLManager pxm = new ProjectXMLManager(project); pxm.removeTestDependency(testType, testDep.getModule().getCodeNameBase()); pxm.addTestDependency(testType, editedDep); ProjectManager.getDefault().saveProject(project); } catch (IOException e) { Exceptions.attachMessage(e, "Cannot store dependency: " + editedDep); // NOI18N Exceptions.printStackTrace(e); } } d.dispose(); }
@Messages("CTL_EditModuleDependencyTitle=Edit Module Dependency") private void editModuleDependency(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editModuleDependency ModuleDependency origDep = getDepListModel().getDependency( dependencyList.getSelectedIndex()); EditDependencyPanel editPanel = new EditDependencyPanel( origDep, getProperties().getActivePlatform()); DialogDescriptor descriptor = new DialogDescriptor(editPanel, CTL_EditModuleDependencyTitle()); descriptor.setHelpCtx(new HelpCtx("org.netbeans.modules.apisupport.project.ui.customizer.EditDependencyPanel")); Dialog d = DialogDisplayer.getDefault().createDialog(descriptor); d.setVisible(true); if (descriptor.getValue().equals(DialogDescriptor.OK_OPTION)) { getDepListModel().editDependency(origDep, editPanel.getEditedDependency()); } d.dispose(); dependencyList.requestFocusInWindow(); }
@Messages("MSG_PublicPackagesAddedFmt=Exported {0} public package(s).\nList of public packages can be further customized on \"API Versioning\" tab.") private void exportButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exportButtonActionPerformed int[] selectedIndices = emListComp.getSelectedIndices(); List<File> jars = new ArrayList<File>(); DefaultListModel listModel = getProperties().getWrappedJarsListModel(); for (int i : selectedIndices) { Item item = (Item) listModel.getElementAt(i); if (item.getType() == Item.TYPE_JAR) { jars.add(item.getResolvedFile()); } } if (jars.size() > 0) { int dif = getProperties().exportPackagesFromJars(jars); NotifyDescriptor.Message msg = new NotifyDescriptor.Message( MSG_PublicPackagesAddedFmt(dif)); DialogDisplayer.getDefault().notify(msg); for (File jar : jars) { isJarExportedMap.put(jar, Boolean.TRUE); } } exportButton.setEnabled(false); }
@Messages("LBL_Browse=Browse Inspections") private void browseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseActionPerformed Object selectedInspection = inspectionCombo.getSelectedItem(); AnalyzerFactory analyzerToSelect; String warningToSelect; if (selectedInspection instanceof AnalyzerAndWarning) { analyzerToSelect = ((AnalyzerAndWarning) selectedInspection).analyzer; warningToSelect = SPIAccessor.ACCESSOR.getWarningId(((AnalyzerAndWarning) selectedInspection).wd); } else { analyzerToSelect = null; warningToSelect = ""; } AdjustConfigurationPanel panel = showConfigurationPanel(analyzerToSelect, warningToSelect, null); if (panel != null) { inspectionCombo.setSelectedItem(warningId2Description.get(panel.getIdToRun())); } }
/** * Checks if a given command can be run at the moment from the perspective of the test userdir lock file. * Cf. #63652, #72397, #141069, #207530. * @param command as in {@link ActionProvider} * @param lock from {@link NbModuleProject#getTestUserDirLockFile} or {@link SuiteProject#getTestUserDirLockFile} * @return true if the command is unrelated, there is no lock file, or the lock file is stale and can be safely deleted; * false (after showing a warning dialog) if the command must not proceed */ @Messages({ "ERR_module_already_running=The application is already running within the test user directory. You must shut it down before trying to run it again.", "ERR_ModuleIsBeingRun=Cannot copy/move/rename/delete a module or suite while the application is running; shut it down first." }) static boolean canRunNoLock(String command, File lock) { if (command.equals(ActionProvider.COMMAND_RUN) || command.equals(ActionProvider.COMMAND_DEBUG) || command.equals(ActionProvider.COMMAND_PROFILE)) { if (isLocked(lock)) { DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(ERR_module_already_running())); return false; } } else if (ActionProvider.COMMAND_DELETE.equals(command) || ActionProvider.COMMAND_RENAME.equals(command) || ActionProvider.COMMAND_MOVE.equals(command) || ActionProvider.COMMAND_COPY.equals(command)) { if (isLocked(lock)) { DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(ERR_ModuleIsBeingRun())); return false; } } return true; }
@Messages({ "TITLE_javadoc_disabled=No Public Packages", "ERR_javadoc_disabled=<html>Javadoc cannot be produced for this module.<br>It is not yet configured to export any packages to other modules.", "LBL_configure_pubpkg=Configure Public Packages..." }) private void promptForPublicPackagesToDocument() { // #61372: warn the user, rather than disabling the action. if (ApisupportAntUIUtils.showAcceptCancelDialog( TITLE_javadoc_disabled(), ERR_javadoc_disabled(), LBL_configure_pubpkg(), null, NotifyDescriptor.WARNING_MESSAGE)) { CustomizerProviderImpl cpi = project.getLookup().lookup(CustomizerProviderImpl.class); cpi.showCustomizer(CustomizerProviderImpl.CATEGORY_VERSIONING, CustomizerProviderImpl.SUBCATEGORY_VERSIONING_PUBLIC_PACKAGES); } }
@Messages({"# {0} - job name", "MSG_Starting=Starting {0}"}) @Override public void start() { ProgressHandle handle = ProgressHandleFactory.createHandle( MSG_Starting(this.getName())); handle.start(); try { instance.getBuilderConnector().startJob(this); } finally { handle.finish(); } instance.synchronize(false); }
@Messages({"#NOI18N", "FIND_COVERED_PKGS=findEntries"}) private boolean findCoveredPkgs(Object exportedPackages) { if (defaultCoveredPkgs == null) { defaultCoveredPkgs = FIND_COVERED_PKGS(); } if ("exportedIfPresent".equals(defaultCoveredPkgs)) { // NOI18N return exportedPackages == null; } return "findEntries".equals(defaultCoveredPkgs); // NOI18N }
@Messages({ "FIX_DefaultAccess=Change \"{0}\" to default access", "FIX_ChangeModifiers=Change \"{0}\" to {1}" }) public List<Fix> run(CompilationInfo info, String diagnosticKey, int offset, TreePath treePath, Data<Void> data) { List<Fix> result = new ArrayList<Fix>(); Element ex = info.getTrees().getElement(treePath); if (treePath.getLeaf().getKind() == Kind.METHOD && ex != null && ex.getKind() == ElementKind.METHOD) { Set<Modifier> desiredAccess = EnumSet.noneOf(Modifier.class); ExecutableElement overridden = info.getElementUtilities().getOverriddenMethod((ExecutableElement) ex); if (overridden != null) { desiredAccess.addAll(overridden.getModifiers()); desiredAccess.retainAll(ACCESS_RIGHT_MASK); } else { desiredAccess.add(Modifier.PUBLIC); } Set<Modifier> toRemove = EnumSet.noneOf(Modifier.class); toRemove.addAll(ex.getModifiers()); toRemove.retainAll(ACCESS_RIGHT_MASK); String name = ex.getSimpleName().toString(); String modifier = desiredAccess.isEmpty() ? Bundle.FIX_DefaultAccess(name) : Bundle.FIX_ChangeModifiers(name, desiredAccess.iterator().next().name().toLowerCase()); result.add(FixFactory.changeModifiersFix(info, new TreePath(treePath, ((MethodTree) treePath.getLeaf()).getModifiers()), desiredAccess, toRemove, modifier)); } return result; }
@Messages({ "MSG_SaveModified=File {0} is modified. Save?" }) @Override public CloseOperationState canCloseElement() { final CloneableEditorSupport sup = getLookup().lookup(CloneableEditorSupport.class); Enumeration en = getReference().getComponents(); if (en.hasMoreElements()) { en.nextElement(); if (en.hasMoreElements()) { // at least two is OK return CloseOperationState.STATE_OK; } } PropertiesDataObject dataObject = getDataObject(); if (dataObject.isModified()) { AbstractAction save = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { try { sup.saveDocument(); } catch (IOException ex) { Exceptions.printStackTrace(ex); } } }; save.putValue(Action.LONG_DESCRIPTION, Bundle.MSG_SaveModified(FileUtil.getFileDisplayName(dataObject.getPrimaryFile()))); return MultiViewFactory.createUnsafeCloseState("editor", save, null); } return CloseOperationState.STATE_OK; }
@Messages("ERR_NoClassName=Must specify a class name") private void updateData() { storeToDataModel(); createdFilesValue.setText(WizardUtils.generateTextAreaContent( data.getCreatedModifiedFiles().getCreatedPaths())); modifiedFilesValue.setText(WizardUtils.generateTextAreaContent( data.getCreatedModifiedFiles().getModifiedPaths())); if (data.getClassName().isEmpty()) { setError(Bundle.ERR_NoClassName()); } else { markValid(); } }
@Override @Messages({ "# {0} - classname", "LBL_Class_Search_ALL_Fix=Search Dependency at Maven Repositories for {0}"}) public String getText() { return LBL_Class_Search_ALL_Fix(clazz); }
@Override @Messages("SYSTEM=System") public void visit(IssueManagement target) { IssueManagement t = target; assert t != null ? t.isInDocumentModel() : true; POMQNames names = parent.getPOMQNames(); checkChildString(names.SYSTEM, SYSTEM(), t != null ? t.getSystem() : null); checkChildString(names.URL, URL(), t != null ? t.getUrl() : null); count++; }
@Override @Messages("TXT_No_Res=No resolution for the problem") public Future<ProjectProblemsProvider.Result> resolve() { FutureTask<Result> toRet = new FutureTask<ProjectProblemsProvider.Result>(new Callable<ProjectProblemsProvider.Result>() { @Override public ProjectProblemsProvider.Result call() throws Exception { if (action != null) { SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { action.actionPerformed(null); } }); String text = (String) action.getValue(ACT_START_MESSAGE); if (text != null) { return ProjectProblemsProvider.Result.create(Status.RESOLVED, text); } else { return ProjectProblemsProvider.Result.create(Status.RESOLVED); } } else { return ProjectProblemsProvider.Result.create(Status.UNRESOLVED, TXT_No_Res()); } } }); RP.post(toRet); return toRet; }
@SuppressWarnings("LeakingThisInConstructor") @Messages({"# {0} - repo name", "LBL_Transfer=Transferring Maven repository index: {0}"}) public RemoteIndexTransferListener(RepositoryInfo info) { this.info = info; Cancellation.register(this); handle = ProgressHandle.createHandle(Bundle.LBL_Transfer(info.getName()), this); handle.start(); }
@Messages({"# {0} - branch name", "MSG_Err.noRemoteBranch=No remote found for branch {0}", "MSG_Err.noRemote=No remote defined in repository configuration", "# {0} - remote count", "MSG_Err.moreRemotes=Cannot choose from {0} remotes", "# {0} - branch name", "MSG_Err.noUri=No URI specified for remote {0}", "# {0} - branch name", "MSG_Err.noSpecs=No fetch ref specs specified for remote {0}"}) protected static GitRemoteConfig getRemoteConfigForActiveBranch (GitBranch trackedBranch, RepositoryInfo info, String errorLabel) { Map<String, GitRemoteConfig> remotes = info.getRemotes(); GitRemoteConfig cfg; if (trackedBranch == null) { if (remotes.size() == 1) { cfg = remotes.values().iterator().next(); } else if (remotes.isEmpty()) { GitUtils.notifyError(errorLabel, MSG_Err_noRemote()); return null; } else { GitUtils.notifyError(errorLabel, MSG_Err_moreRemotes(remotes.size())); return null; } } else { String remoteName = parseRemote(trackedBranch.getName()); cfg = remoteName == null ? null : remotes.get(remoteName); if (cfg == null) { GitUtils.notifyError(errorLabel, MSG_Err_noRemoteBranch(trackedBranch.getName())); return null; } } if (cfg.getPushUris().isEmpty() && cfg.getUris().isEmpty()) { GitUtils.notifyError(errorLabel, MSG_Err_noUri(cfg.getRemoteName())); return null; } if (cfg.getFetchRefSpecs().isEmpty()) { GitUtils.notifyError(errorLabel, MSG_Err_noSpecs(cfg.getRemoteName())); return null; } return cfg; }
@Override @Messages({"TARGET_PATH=Target Path", "INCLUDES=Includes", "INCLUDE=Include", "EXCLUDES=Excludes", "EXCLUDE=Exclude"}) public void visit(Resource target) { Resource t = target; assert t != null ? t.isInDocumentModel() : true; POMQNames names = parent.getPOMQNames(); checkChildString(names.TARGETPATH, TARGET_PATH(), t != null ? t.getTargetPath() : null); //TODO filtering checkChildString(names.DIRECTORY, DIRECTORY(), t != null ? t.getDirectory() : null); checkStringListObject(names.INCLUDES, names.INCLUDE, INCLUDES(), INCLUDE(), t != null ? t.getIncludes() : null); checkStringListObject(names.EXCLUDES, names.EXCLUDE, EXCLUDES(), EXCLUDE(), t != null ? t.getExcludes() : null); count++; }
@Messages("LBL_Edit_Jar_Panel_browse=Select JAR/folder") private void btnJavadocActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnJavadocActionPerformed // Let user search for the Jar file FileChooser chooser; if (helper.isSharableProject()) { chooser = new FileChooser(helper, true); } else { chooser = new FileChooser(FileUtil.toFile(helper.getProjectDirectory()), null); } chooser.enableVariableBasedSelection(true); chooser.setFileHidingEnabled(false); FileUtil.preventFileChooserSymlinkTraversal(chooser, null); chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); chooser.setMultiSelectionEnabled(false); chooser.setDialogTitle(LBL_Edit_Jar_Panel_browse()); //#61789 on old macosx (jdk 1.4.1) these two method need to be called in this order. chooser.setAcceptAllFileFilterUsed(false); chooser.setFileFilter(new SimpleFileFilter( "Javadoc Entry (folder, ZIP or JAR file)", new String[]{"ZIP", "JAR"})); // NOI18N File curDir = helper.resolveFile(helper.getStandardPropertyEvaluator().evaluate(item.getJarFile())); chooser.setCurrentDirectory(curDir); int option = chooser.showOpenDialog(SwingUtilities.getWindowAncestor(this)); // Sow the chooser if (option == JFileChooser.APPROVE_OPTION) { String files[]; try { files = chooser.getSelectedPaths(); } catch (IOException ex) { // TODO: add localized message Exceptions.printStackTrace(ex); return; } txtJavadoc.setText(chooser.getSelectedPathVariables() != null ? stripOffVariableMarkup(chooser.getSelectedPathVariables()[0]) : files[0]); } }
@Messages("MSG_Remove_Module=Do you want to remove the module from the parent POM?") @Override public void actionPerformed(ActionEvent e) { NotifyDescriptor nd = new NotifyDescriptor.Confirmation(MSG_Remove_Module(), NotifyDescriptor.YES_NO_OPTION); Object ret = DialogDisplayer.getDefault().notify(nd); if (ret == NotifyDescriptor.YES_OPTION) { FileObject fo = FileUtil.toFileObject(parent.getPOMFile()); ModelOperation<POMModel> operation = new ModelOperation<POMModel>() { @Override public void performOperation(POMModel model) { List<String> modules = model.getProject().getModules(); if (modules != null) { for (String path : modules) { File rel = new File(parent.getPOMFile().getParent(), path); File norm = FileUtil.normalizeFile(rel); FileObject folder = FileUtil.toFileObject(norm); if (folder != null && folder.equals(project.getProjectDirectory())) { model.getProject().removeModule(path); break; } } } } }; org.netbeans.modules.maven.model.Utilities.performPOMModelOperations(fo, Collections.singletonList(operation)); //TODO is the manual reload necessary if pom.xml file is being saved? NbMavenProject.fireMavenProjectReload(project); } }
@Messages("AD_Libraries=N/A") LibrariesView() { this.setRootVisible(false); this.setPopupAllowed(false); this.setDefaultActionAllowed(false); this.tree.setEditable (false); this.tree.setShowsRootHandles (false); this.getAccessibleContext().setAccessibleDescription(AD_Libraries()); }
/** Fills given collection with flattened packages under given folder *@param target The collection to be filled *@param fo The folder to be scanned * @param group the group to scan * @param createPackageItems if false the collection will be filled with file objects; if * true PackageItems will be created. * @param showProgress whether to show a progress handle or not */ @Messages({"# {0} - root folder", "PackageView.find_packages_progress=Finding packages in {0}"}) static void findNonExcludedPackages(PackageViewChildren children, Collection<PackageItem> target, FileObject fo, SourceGroup group, boolean showProgress) { if (showProgress) { ProgressHandle progress = ProgressHandleFactory.createHandle(PackageView_find_packages_progress(FileUtil.getFileDisplayName(fo))); progress.start(1000); findNonExcludedPackages(children, target, fo, group, progress, 0, 1000); progress.finish(); } else { findNonExcludedPackages(children, target, fo, group, null, 0, 0); } }
@MultiViewElement.Registration( mimeType=PUDataLoader.REQUIRED_MIME, iconBase=ICON, persistenceType=TopComponent.PERSISTENCE_ONLY_OPENED, preferredID=PREFERRED_ID_SOURCE, displayName="#CTL_SourceTabCaption", position=2000 ) @Messages("CTL_SourceTabCaption=Source") public static XmlMultiViewElement createXmlMultiViewElement(Lookup lookup) { return new XmlMultiViewElement(lookup.lookup(XmlMultiViewDataObject.class)); }
@Override @Messages("TIT_Action_Mappings=Actions") public Category createCategory(Lookup context) { return ProjectCustomizer.Category.create( ModelHandle2.PANEL_MAPPING, TIT_Action_Mappings(), null); }
@Override @Messages({"TOOLTIP_Defined_in=Value is defined in the following POM files:", "TOOLTIP_ArtifactId=POM ArtifactId", "TOOLTIP_Value=Value", "UNDEFINED=<Undefined>"}) public String getShortDescription() { StringBuilder buff = new StringBuilder(); buff.append("<html>").append(TOOLTIP_Defined_in()).append("<p><table><thead><tr><th>") .append(TOOLTIP_ArtifactId()).append("</th><th>") .append(TOOLTIP_Value()) .append("</th></tr></thead><tbody>"); //NOI18N String[] values = getLookup().lookup(POMCutHolder.class).getCutValuesAsString(); POMModel[] mdls = getLookup().lookup(POMCutHolder.class).getSource(); if (values.length == mdls.length) { int index = 0; for (POMModel mdl : mdls) { String artifact = mdl.getProject().getArtifactId(); buff.append("<tr><td>"); //NOI18N buff.append(artifact != null ? artifact : "project"); buff.append("</td><td>"); //NOI18N buff.append(values[index] != null ? values[index] : UNDEFINED()); buff.append("</td></tr>");//NOI18N index++; } } else { LOG.log(Level.WARNING, "#180901: {0} length does not match {1} length", new Object[] {Arrays.toString(values), Arrays.toString(mdls)}); } buff.append("</tbody></table>");//NOI18N return buff.toString(); }
@NbBundle.Messages({"# {0} - [@throws|@exception]", "# {1} - @throws name", "DUPLICATE_THROWS_DESC=Duplicate @{0} tag: {1}", "# {0} - [@throws|@exception]", "# {1} - @throws name", "UNKNOWN_THROWABLE_DESC=Unknown throwable: @{0} {1}"}) private void checkThrowsDeclared(ThrowsTree tree, Element ex, String fqn, List<? extends TypeMirror> list, DocTreePathHandle dtph, int start, int end, List<ErrorDescription> errors) { boolean found = false; final TypeMirror type; if(ex != null) { type = ex.asType(); } else { TypeElement typeElement = javac.getElements().getTypeElement(fqn); if(typeElement != null) { type = typeElement.asType(); } else { type = null; } } for (TypeMirror t: list) { if(ctx.isCanceled()) { return; } if(type != null && javac.getTypes().isAssignable(type, t)) { if(!foundThrows.add(type)) { errors.add(ErrorDescriptionFactory.forSpan(ctx, start, end, DUPLICATE_THROWS_DESC(tree.getTagName(), fqn), new RemoveTagFix(dtph, "@" + tree.getTagName()).toEditorFix())); } found = true; break; } if (type == null && fqn.equals(t.toString())) { if(!foundThrows.add(t)) { errors.add(ErrorDescriptionFactory.forSpan(ctx, start, end, DUPLICATE_THROWS_DESC(tree.getTagName(), fqn), new RemoveTagFix(dtph, "@" + tree.getTagName()).toEditorFix())); } found = true; break; } } if (!found) { errors.add(ErrorDescriptionFactory.forSpan(ctx, start, end, UNKNOWN_THROWABLE_DESC(tree.getTagName(), fqn), new RemoveTagFix(dtph, "@" + tree.getTagName()).toEditorFix())); } }
/** Creates new form InstallPanel */ @Messages({"TXT_Javadoc_Loc=Javadoc JAR/ZIP Location:", "TXT_Sources_Loc=Sources JAR/ZIP Location"}) private InstallDocSourcePanel(boolean javadoc) { initComponents(); docs = javadoc; if (javadoc) { lblFile.setText(TXT_Javadoc_Loc()); } else { lblFile.setText(TXT_Sources_Loc()); } }
@NbBundle.Messages({ "LBL_Push.createNewBranch=Create New Branch?", "# {0} - branch name", "MSG_Push.createNewBranch=Push is about to create a new branch \"{0}\" in the remote repository.\n" + "Do you want to continue and create the branch?" }) private static boolean shallCreateNewBranch (GitBranch branch) { return NotifyDescriptor.YES_OPTION == DialogDisplayer.getDefault().notify(new NotifyDescriptor.Confirmation( Bundle.MSG_Push_createNewBranch(branch.getName()), Bundle.LBL_Push_createNewBranch(), NotifyDescriptor.YES_NO_OPTION, NotifyDescriptor.QUESTION_MESSAGE)); }
@Messages({ "some key=some value", "public=property", "2+2=4" }) public void testNonIdentifierKeys() throws Exception { assertEquals("some value", some_key()); assertEquals("property", _public()); assertEquals("4", _2_2()); }
@Messages({ "ERR_NoNetwork=Warning: No network connection. This wizard is based on Maven.\n" + "To work properly it needs a network connection. Please check your network settings: {0}\n", }) static void loadError(WizardData model, Throwable t) { model.setWarning(Bundle.ERR_NoNetwork(t.getLocalizedMessage())); }
@MultiViewElement.Registration( displayName="#CTL_SourceTabCaption", iconBase="org/apache/tools/ant/module/resources/AntIcon.gif", persistenceType=TopComponent.PERSISTENCE_ONLY_OPENED, preferredID="ant", mimeType=MIME_TYPE, position=1 ) @Messages("CTL_SourceTabCaption=&Source") public static MultiViewEditorElement createMultiViewEditorElement(Lookup context) { return new MultiViewEditorElement(context); }
@Messages("ERR_NameExists=Library with given name already exists.") public @Override void validate(Problems problems, String compName, String model) { LibraryManager manager = (LibraryManager) comManager.getSelectedItem(); String currentName = model.trim(); if (manager.getLibrary(currentName) != null) { problems.add(ERR_NameExists()); } }