org.openide.awt.StatusDisplayer Java Examples
The following examples show how to use
org.openide.awt.StatusDisplayer.
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: GoToDecoratorAtCaretAction.java From netbeans with Apache License 2.0 | 6 votes |
private void showPopup( LinkedHashSet<TypeElement> elements , CompilationController controller, MetadataModel<WebBeansModel> model ,JTextComponent target ) { List<ElementHandle<? extends Element>> handles = new ArrayList< ElementHandle<? extends Element>>(elements.size()); for (TypeElement element : elements) { handles.add( ElementHandle.create( element )); } StatusDisplayer.getDefault().setStatusText(NbBundle.getMessage( InjectablesModel.class, "LBL_WaitNode")); try { Rectangle rectangle = target.modelToView(target.getCaret().getDot()); Point point = new Point(rectangle.x, rectangle.y + rectangle.height); SwingUtilities.convertPointToScreen(point, target); String title = NbBundle.getMessage( GoToInjectableAtCaretAction.class, "LBL_ChooseDecorator"); PopupUtil.showPopup(new InjectablesPopup(title, handles, controller), title, point.x, point.y); } catch (BadLocationException ex) { Exceptions.printStackTrace(ex); } }
Example #2
Source File: AutoHideStatusText.java From netbeans with Apache License 2.0 | 6 votes |
private AutoHideStatusText( JFrame frame, JPanel statusContainer ) { this.statusContainer = statusContainer; Border outerBorder = UIManager.getBorder( "Nb.ScrollPane.border" ); //NOI18N if( null == outerBorder ) { outerBorder = BorderFactory.createEtchedBorder(); } panel.setBorder( BorderFactory.createCompoundBorder( outerBorder, BorderFactory.createEmptyBorder(3,3,3,3) ) ); lblStatus.setName("AutoHideStatusTextLabel"); //NOI18N panel.add( lblStatus, BorderLayout.CENTER ); frame.getLayeredPane().add( panel, Integer.valueOf( 101 ) ); StatusDisplayer.getDefault().addChangeListener( this ); frame.addComponentListener( new ComponentAdapter() { @Override public void componentResized( ComponentEvent e ) { run(); } }); }
Example #3
Source File: HandleLayer.java From netbeans with Apache License 2.0 | 6 votes |
@Override public void mouseEntered(MouseEvent e) { if (formDesigner.getDesignerMode() == FormDesigner.MODE_ADD) { formDesigner.requestActive(); PaletteItem item = PaletteUtils.getSelectedItem(); if(formDesigner.getMenuEditLayer().isPossibleNewMenuComponent(item)) { formDesigner.getMenuEditLayer().startNewMenuComponentPickAndPlop(item,e.getPoint()); return; } Node itemNode; if (item != null && (itemNode = item.getNode()) != null) { StatusDisplayer.getDefault().setStatusText( FormUtils.getFormattedBundleString( "FMT_MSG_AddingComponent", // NOI18N new String[] { itemNode.getDisplayName() })); } } }
Example #4
Source File: InjectablesActionStrategy.java From netbeans with Apache License 2.0 | 6 votes |
@Override public boolean isApplicable( WebBeansModel model, Object context[] ) { final VariableElement var = WebBeansActionHelper.findVariable(model, context); if (var == null) { return false; } try { if ( model.isEventInjectionPoint(var)){ return false; } if (!model.isInjectionPoint(var)) { StatusDisplayer.getDefault().setStatusText( NbBundle.getMessage(GoToInjectableAtCaretAction.class, "LBL_NotInjectionPoint"), // NOI18N StatusDisplayer.IMPORTANCE_ERROR_HIGHLIGHT); return false; } } catch (InjectionPointDefinitionError e) { StatusDisplayer.getDefault().setStatusText(e.getMessage(), StatusDisplayer.IMPORTANCE_ERROR_HIGHLIGHT); } return true; }
Example #5
Source File: ResourceHyperlinkProcessor.java From netbeans with Apache License 2.0 | 6 votes |
@Override public void process(HyperlinkEnv env) { FileObject fo = env.getFileObject(); if (fo == null) { return; } FileObject parent = fo.getParent(); String value = env.getValueString(); if (value.contains("classpath")) { //NOI18N if (openFromClasspath(fo, value)) { return; } } else { if (openFile(parent.getFileObject(env.getValueString()))) { return; } } String message = NbBundle.getMessage(ResourceHyperlinkProcessor.class, "LBL_ResourceNotFound", env.getValueString()); //NOI18N StatusDisplayer.getDefault().setStatusText(message); }
Example #6
Source File: WebBeansActionHelper.java From netbeans with Apache License 2.0 | 6 votes |
static void showInterceptorsDialog( MetadataModel<WebBeansModel> metaModel, WebBeansModel model, Object[] subject, InterceptorsModel uiModel, String name , InterceptorsResult result ) { subject[2] = InspectActionId.CLASS_CONTEXT; StatusDisplayer.getDefault().setStatusText(NbBundle.getMessage( InjectablesModel.class, WAIT_NODE)); JDialog dialog = ResizablePopup.getDialog(); String title = NbBundle.getMessage(WebBeansActionHelper.class, "TITLE_Interceptors" , name );//NOI18N dialog.setTitle( title ); dialog.setContentPane( new InterceptorsPanel(subject, metaModel, model ,uiModel , result)); dialog.setVisible( true ); }
Example #7
Source File: DependencyNode.java From netbeans with Apache License 2.0 | 6 votes |
@Override @Messages({ "# {0} - artifact path", "ERR_No_Javadoc_Found=Javadoc for {0} not found."}) public void actionPerformed(ActionEvent e) { DataObject dobj = getOriginal().getLookup().lookup(DataObject.class); if (dobj == null) { return; } FileObject fil = dobj.getPrimaryFile(); FileObject jar = FileUtil.getArchiveFile(fil); FileObject root = FileUtil.getArchiveRoot(jar); String rel = FileUtil.getRelativePath(root, fil); rel = rel.replaceAll("[.]class$", ".html"); //NOI18N JavadocForBinaryQuery.Result res = JavadocForBinaryQuery.findJavadoc(root.toURL()); if (fil.isFolder()) { rel = rel + "/package-summary.html"; //NOI18N } URL javadocUrl = findJavadoc(rel, res.getRoots()); if (javadocUrl != null) { HtmlBrowser.URLDisplayer.getDefault().showURL(javadocUrl); } else { StatusDisplayer.getDefault().setStatusText(ERR_No_Javadoc_Found(fil.getPath())); } }
Example #8
Source File: FindSupport.java From netbeans with Apache License 2.0 | 6 votes |
void updatePattern() { reset(); String p = bar.getPattern(); if (!bar.getRegularExpression()) { p = Pattern.quote(p); if (bar.getWholeWords()) { p="\\b"+p+"\\b"; // NOI18N } } int flags = Pattern.MULTILINE; if (!bar.getMatchCase()) { flags |= Pattern.CASE_INSENSITIVE; } try { pattern = Pattern.compile(p, flags); } catch (PatternSyntaxException psex) { String message = NbBundle.getMessage(FindSupport.class, "FindBar.invalidExpression"); // NOI18N StatusDisplayer.getDefault().setStatusText(message, StatusDisplayer.IMPORTANCE_FIND_OR_REPLACE); } findNext(); if (bar.getHighlightResults()) { highlight(tc, false); } }
Example #9
Source File: BookmarkUtils.java From netbeans with Apache License 2.0 | 6 votes |
public static void openEditor(EditorCookie ec, int lineIndex) { Line.Set lineSet = ec.getLineSet(); if (lineSet != null) { try { Line line = lineSet.getCurrent(lineIndex); if (line != null) { line.show(Line.ShowOpenType.OPEN, Line.ShowVisibilityType.FOCUS); } } catch (IndexOutOfBoundsException ex) { // attempt at least to open the editor ec.open(); // expected, bookmark contains an invalid line StatusDisplayer.getDefault().setStatusText( NbBundle.getMessage(BookmarkUtils.class, "MSG_InvalidLineNumnber", lineIndex)); } JEditorPane[] panes = ec.getOpenedPanes(); if (panes.length > 0) { panes[0].requestFocusInWindow(); } } }
Example #10
Source File: WebBeansActionHelper.java From netbeans with Apache License 2.0 | 6 votes |
/** * Based on the context element method chooses different element. * If element is not "injection" ( not injection point and has no * injection context ) method sets the error message in the status * and return null. */ static Element getContextElement(Element element , CompilationController controller ) { if ( element instanceof TypeElement ){ if ( hasAnnotation(element, DECORATOR) ){ List<VariableElement> fieldsIn = ElementFilter.fieldsIn( controller.getElements().getAllMembers((TypeElement)element)); for (VariableElement variableElement : fieldsIn) { if ( hasAnnotation(variableElement, DELEGATE)){ return variableElement; } } StatusDisplayer.getDefault().setStatusText( NbBundle.getMessage( WebBeansActionHelper.class, "LBL_NotDecorator")); } return null; } return element; }
Example #11
Source File: DocumentationScrollPane.java From netbeans with Apache License 2.0 | 6 votes |
private synchronized void setDocumentation(CompletionDocumentation doc) { currentDocumentation = doc; if (currentDocumentation != null) { String text = currentDocumentation.getText(); URL url = currentDocumentation.getURL(); if (text != null){ Document document = view.getDocument(); document.putProperty(Document.StreamDescriptionProperty, null); if (url!=null){ // fix of issue #58658 if (document instanceof HTMLDocument){ ((HTMLDocument)document).setBase(url); } } view.setContent(text, url != null ? url.getRef() : null); } else if (url != null){ try{ view.setPage(url); }catch(IOException ioe){ StatusDisplayer.getDefault().setStatusText(ioe.toString()); } } bShowWeb.setEnabled(url != null); bGoToSource.setEnabled(currentDocumentation.getGotoSourceAction() != null); } }
Example #12
Source File: WebBeansActionHelper.java From netbeans with Apache License 2.0 | 6 votes |
static void showInjectablesDialog( MetadataModel<WebBeansModel> metamodel, WebBeansModel model, Object[] subject, InjectablesModel uiModel , String name , org.netbeans.modules.web.beans.api.model.Result result ) { subject[2] = InspectActionId.INJECTABLES_CONTEXT; StatusDisplayer.getDefault().setStatusText(NbBundle.getMessage( InjectablesModel.class, WAIT_NODE)); // NOI18N JDialog dialog = ResizablePopup.getDialog(); String title = NbBundle.getMessage(WebBeansActionHelper.class, "TITLE_Injectables" , name );//NOI18N dialog.setTitle( title ); dialog.setContentPane( new BindingsPanel(subject, metamodel, model, uiModel, result )); dialog.setVisible( true ); }
Example #13
Source File: HtmlBrowserComponent.java From netbeans with Apache License 2.0 | 6 votes |
@Override public void propertyChange (PropertyChangeEvent e) { if( HtmlBrowser.Impl.PROP_STATUS_MESSAGE.equals(e.getPropertyName()) ) { StatusDisplayer.getDefault().setStatusText(browserComponent.getBrowserImpl().getStatusMessage()); return; } else if( HtmlBrowser.Impl.PROP_TITLE.equals (e.getPropertyName ()) ) { String title = browserComponent.getBrowserImpl().getTitle(); if ((title == null) || (title.length () < 1)) return; setToolTipText(title); setDisplayName( makeShort(title) ); } else if( HtmlBrowser.Impl.PROP_LOADING.equals (e.getPropertyName ()) ) { boolean loading = ((Boolean)e.getNewValue()).booleanValue(); makeBusy( loading ); } }
Example #14
Source File: PhingExecutable.java From netbeans with Apache License 2.0 | 6 votes |
@NbBundle.Messages("TargetList.error=Cannot get Phing targets.") private synchronized List<String> getPhingTargets() { if (phingTargets != null) { return Collections.unmodifiableList(phingTargets); } if (result == null || result == 1) { RP.post(new Runnable() { @Override public void run() { phing.run(getListTargetsParams().toArray(new String[0])); } }); StatusDisplayer.getDefault().setStatusText(Bundle.TargetList_error()); phingTargets = Collections.emptyList(); return Collections.unmodifiableList(phingTargets); } List<String> targets = new ArrayList<>(processor.getTargets()); Collections.sort(targets); phingTargets = new CopyOnWriteArrayList<>(targets); return Collections.unmodifiableList(phingTargets); }
Example #15
Source File: GoToSource.java From netbeans with Apache License 2.0 | 6 votes |
@NbBundle.Messages({ "OpeningFileMsg=Opening source file {0}", "OpenFileFailsMessage=File \"{0}\" does not exist or the offset \"{1}\" is out of range" }) private static void openFileImpl(FileObject srcFile, int offset) { // *** logging stuff *** ProfilerLogger.debug("Open Source: FileObject: " + srcFile); // NOI18N ProfilerLogger.debug("Open Source: Offset: " + offset); // NOI18N Collection<? extends GoToSourceProvider> implementations = Lookup.getDefault().lookupAll(GoToSourceProvider.class); String st = Bundle.OpeningFileMsg(srcFile.getName()); final String finalStatusText = st + " ..."; // NOI18N StatusDisplayer.getDefault().setStatusText(finalStatusText); for(GoToSourceProvider impl : implementations) { try { if (impl.openFile(srcFile, offset)) return; } catch (Exception e) { ProfilerLogger.log(e); } } ProfilerDialogs.displayError(Bundle.OpenFileFailsMessage(srcFile.getName(), offset)); }
Example #16
Source File: PopupSwitcher.java From netbeans with Apache License 2.0 | 6 votes |
private void _updateDescription() { if( !lblDescription.isValid() ) { SwingUtilities.invokeLater( new Runnable() { @Override public void run() { updateDescription(); } }); return; } Item item = table.getSelectedItem(); String statusText = item == null ? null : item.getDescription(); StatusDisplayer.getDefault().setStatusText( statusText ); if( null == statusText ) { int selRow = table.getSelectedRow(); int selCol = table.getSelectedColumn(); if( selRow >= 0 && selCol >= 0 ) { TableCellRenderer ren = table.getCellRenderer( selRow, selCol ); Component c = table.prepareRenderer( ren, selRow, selCol); if( c.getPreferredSize().width > table.getColumnModel().getColumn( selCol ).getWidth() ) { statusText = table.getSelectedItem().getDisplayName(); } } } lblDescription.setText( truncateText( statusText, lblDescription.getWidth() ) ); }
Example #17
Source File: ObserversActionStrategy.java From netbeans with Apache License 2.0 | 6 votes |
@Override public boolean isApplicable( WebBeansModel model, Object context[] ) { final VariableElement var = WebBeansActionHelper.findVariable(model,context); if (var == null) { return false; } if (context[2] == InspectActionId.OBSERVERS_CONTEXT && !model.isEventInjectionPoint(var)) { StatusDisplayer.getDefault().setStatusText( NbBundle.getMessage(GoToInjectableAtCaretAction.class, "LBL_NotEventInjectionPoint"), // NOI18N StatusDisplayer.IMPORTANCE_ERROR_HIGHLIGHT); return false; } return model.isEventInjectionPoint(var); }
Example #18
Source File: SimpleGraphOpener.java From constellation with Apache License 2.0 | 6 votes |
@Override protected void done() { if (gex != null) { Logger.getLogger(SimpleGraphFileOpener.class.getName()).log(Level.INFO, "Opening " + gdo.getPrimaryFile().getPath(), gex); String exName = gex.getClass().getCanonicalName(); if (exName.lastIndexOf('.') != -1) { exName = exName.substring(exName.lastIndexOf('.') + 1); } final NotifyDescriptor d = new NotifyDescriptor.Message(String.format("%s error opening graph:%n%s", exName, gex.getMessage()), NotifyDescriptor.ERROR_MESSAGE); DialogDisplayer.getDefault().notify(d); } else if (graph != null) { StatusDisplayer.getDefault().setStatusText(String.format("%s read complete (%.1fs)", gdo.getPrimaryFile().getName(), time / 1000f)); final SimpleGraphTopComponent vtc = new SimpleGraphTopComponent(gdo, graph); vtc.open(); vtc.requestActive(); } if (doAfter != null) { doAfter.run(); } }
Example #19
Source File: BridgeImpl.java From netbeans with Apache License 2.0 | 5 votes |
public void stop(final Thread process) { NbBuildLogger logger; synchronized (loggersByThread) { logger = loggersByThread.get(process); } if (logger != null) { // Try stopping at a safe point. StatusDisplayer.getDefault().setStatusText(NbBundle.getMessage(BridgeImpl.class, "MSG_stopping", logger.getDisplayNameNoLock())); logger.stop(); } process.interrupt(); // But if that doesn't do it, double-check later... // Yes Thread.stop() is deprecated; that is why we try to avoid using it. RP.create(new StopProcess(process)).schedule(STOP_TIMEOUT); }
Example #20
Source File: ProfilerStatus.java From visualvm with GNU General Public License v2.0 | 5 votes |
public void log(final String text) { SwingUtilities.invokeLater(new Runnable() { public void run() { StatusDisplayer.Message message = StatusDisplayer.getDefault().setStatusText(text, 1000); message.clear(STATUS_TIMEOUT); lastMessage = new WeakReference(message); } }); }
Example #21
Source File: StrutsConfigHyperlinkProvider.java From netbeans with Apache License 2.0 | 5 votes |
@NbBundle.Messages({ "lbl.goto.formbean.not.found=ActionForm Bean {0} not found." }) private void findForm(String name, BaseDocument doc){ ExtSyntaxSupport sup = (ExtSyntaxSupport)doc.getSyntaxSupport(); int offset = findDefinitionInSection(sup, "form-beans", "form-bean", "name", name); if (offset > 0){ JTextComponent target = Utilities.getFocusedComponent(); target.setCaretPosition(offset); } else { StatusDisplayer.getDefault().setStatusText(Bundle.lbl_goto_formbean_not_found(name)); } }
Example #22
Source File: JavaCompilerProcessorFactory.java From netbeans with Apache License 2.0 | 5 votes |
private static Runnable openFileAt(final ClassPath classPath, final String fileName, final int line) { return new Runnable() { @Override public void run() { String baseName = fileName.substring(0, fileName.lastIndexOf('.')); String resourceName = baseName + ".class"; //NOI18N FileObject resource = classPath.findResource(resourceName); FileObject javaFo = null; if (resource != null) { FileObject cpRoot = classPath.findOwnerRoot(resource); if (cpRoot != null) { URL url = URLMapper.findURL(cpRoot, URLMapper.INTERNAL); SourceForBinaryQuery.Result res = SourceForBinaryQuery.findSourceRoots(url); FileObject[] rootz = res.getRoots(); for (FileObject root : rootz) { javaFo = root.getFileObject(fileName); if (javaFo != null) { LocationOpener.openAtLine(javaFo, line, GradleSettings.getDefault().isReuseEditorOnStackTace()); break; } } } } if (javaFo == null) { StatusDisplayer.getDefault().setStatusText("Not found: " + fileName); } } }; }
Example #23
Source File: CutToClipboardPlugin.java From constellation with Apache License 2.0 | 5 votes |
@Override protected void edit(final GraphWriteMethods wg, final PluginInteraction interaction, final PluginParameters parameters) throws InterruptedException, PluginException { // Do a copy to the clipboard. final String text = GraphCopyUtilities.copyGraphTextToSystemClipboard(wg); ConstellationLoggerHelper.copyPropertyBuilder(this, text.length(), ConstellationLoggerHelper.SUCCESS); final BitSet[] selectedElements = GraphCopyUtilities.copySelectedGraphElementsToClipboard(wg); final BitSet vxCopied = selectedElements[0]; final BitSet txCopied = selectedElements[1]; if (vxCopied != null && txCopied != null) { // Delete the elements that were copied. for (int id = vxCopied.nextSetBit(0); id >= 0; id = vxCopied.nextSetBit(id + 1)) { wg.removeVertex(id); } for (int id = txCopied.nextSetBit(0); id >= 0; id = txCopied.nextSetBit(id + 1)) { if (wg.transactionExists(id)) { wg.removeTransaction(id); } } final String msg = Bundle.MSG_Cut(vxCopied.cardinality(), txCopied.cardinality()); final StatusDisplayer statusDisplayer = StatusDisplayer.getDefault(); if (statusDisplayer != null) { statusDisplayer.setStatusText(msg); } } else { throw new PluginException(PluginNotificationLevel.ERROR, "Failed to copy selection to the clipboard"); } }
Example #24
Source File: TomcatWebModule.java From netbeans with Apache License 2.0 | 5 votes |
public void updateState() { DeploymentStatus deployStatus = progressObject.getDeploymentStatus(); synchronized (this) { if (finished || deployStatus == null) { return; } if (deployStatus.isCompleted() || deployStatus.isFailed()) { finished = true; } if (deployStatus.getState() == StateType.COMPLETED) { CommandType command = deployStatus.getCommand(); if (command == CommandType.START || command == CommandType.STOP) { StatusDisplayer.getDefault().setStatusText(deployStatus.getMessage()); if (command == CommandType.START) { isRunning = true; } else { isRunning = false; } node.setDisplayName(constructDisplayName()); } else if (command == CommandType.UNDEPLOY) { StatusDisplayer.getDefault().setStatusText(deployStatus.getMessage()); } } else if (deployStatus.getState() == StateType.FAILED) { NotifyDescriptor notDesc = new NotifyDescriptor.Message( deployStatus.getMessage(), NotifyDescriptor.ERROR_MESSAGE); DialogDisplayer.getDefault().notify(notDesc); StatusDisplayer.getDefault().setStatusText(deployStatus.getMessage()); } } }
Example #25
Source File: OpenAction.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void actionPerformed (ActionEvent ev) { try { performer.open(); } catch (CannotOpen co) { final String msg = co.getLocalizedMessage(); Toolkit.getDefaultToolkit().beep(); if(msg != null) { StatusDisplayer.getDefault().setStatusText(msg); } } }
Example #26
Source File: Nodes.java From netbeans with Apache License 2.0 | 5 votes |
@NbBundle.Messages({"MSG_NoSource=Source not available for {0}"}) @Override public void actionPerformed(ActionEvent e) { if (!ElementOpen.open( description.getClasspathInfo(), description.getHandle())) { Toolkit.getDefaultToolkit().beep(); StatusDisplayer.getDefault().setStatusText( Bundle.MSG_NoSource(description.getHandle().getQualifiedName())); } }
Example #27
Source File: WhereUsedElement.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void openInEditor() { if(parentFile == null || !parentFile.isValid()) { StatusDisplayer.getDefault().setStatusText(WARN_ElementNotFound()); } else { super.openInEditor(); } }
Example #28
Source File: Autosaver.java From constellation with Apache License 2.0 | 5 votes |
@Override public void run() { StatusDisplayer.getDefault().setStatusText(String.format("Auto saving %s at %s...", "", new Date())); final Preferences prefs = NbPreferences.forModule(ApplicationPreferenceKeys.class); final boolean autosaveEnabled = prefs.getBoolean(ApplicationPreferenceKeys.AUTOSAVE_ENABLED, ApplicationPreferenceKeys.AUTOSAVE_ENABLED_DEFAULT); if (autosaveEnabled) { runAutosave(); } final int autosaveSchedule = prefs.getInt(ApplicationPreferenceKeys.AUTOSAVE_SCHEDULE, ApplicationPreferenceKeys.AUTOSAVE_SCHEDULE_DEFAULT); final int delayMinutes = autosaveSchedule; schedule(delayMinutes); }
Example #29
Source File: ShowJavadocAction.java From netbeans with Apache License 2.0 | 5 votes |
/** * Opens the IDE default browser with given URL * @param javadoc URL of the javadoc page * @param displayName the name of file to be displayed, typically the package name for class * or project name for project. */ static void showJavaDoc (URL javadoc, String displayName) { if (javadoc!=null) { HtmlBrowser.URLDisplayer.getDefault().showURL(javadoc); } else { StatusDisplayer.getDefault().setStatusText(MessageFormat.format(NbBundle.getMessage(ShowJavadocAction.class, "TXT_NoJavadoc"), new Object[] {displayName})); //NOI18N } }
Example #30
Source File: DataView.java From netbeans with Apache License 2.0 | 5 votes |
synchronized void setErrorStatusText(Connection con, Statement stmt, String message, Throwable ex) { if (ex != null) { errMessages.add(ex); } errorPosition = ErrorPositionExtractor.extractErrorPosition(con, stmt, ex, sqlString); String title = NbBundle.getMessage(DataView.class, "MSG_error"); StatusDisplayer.getDefault().setStatusText(title + ": " + message); }