/** throws IllegalComponentStateException when can not return the data in AWT. */ private String getCurrentElement(final ElementKind kind, final String[] elementSignaturePtr) throws java.awt.IllegalComponentStateException { return getCurrentElement(contextDispatcher.getCurrentFile(), contextDispatcher.getCurrentEditor(), kind, elementSignaturePtr); }
public static void addPropertyChangeListener (PropertyChangeListener l) { //getContext ().addPropertyChangeListener (l); EditorContextDispatcher.getDefault().addPropertyChangeListener("text/x-jsp", l); EditorContextDispatcher.getDefault().addPropertyChangeListener("text/x-tag", l); }
/** throws IllegalComponentStateException when can not return the data in AWT. */ private String getMostRecentElement(final ElementKind kind, final String[] elementSignaturePtr) throws java.awt.IllegalComponentStateException { return getCurrentElement(contextDispatcher.getMostRecentFile(), contextDispatcher.getMostRecentEditor(), kind, elementSignaturePtr); }
public static void removePropertyChangeListener (PropertyChangeListener l) { //getContext ().removePropertyChangeListener (l); EditorContextDispatcher.getDefault().removePropertyChangeListener(l); }
public static FileObject getCurrentFile() { return EditorContextDispatcher.getDefault().getCurrentFile(); }
public static Line getCurrentLine() { FileObject fo = EditorContextDispatcher.getDefault().getCurrentFile(); if (fo == null) { return null; } if (!JS_MIME_TYPE.equalsIgnoreCase(fo.getMIMEType())) { return null; } return EditorContextDispatcher.getDefault().getCurrentLine(); }
@Override public boolean isDefault() { FileObject mostRecentFile = EditorContextDispatcher.getDefault().getMostRecentFile(); if (mostRecentFile == null) { return false; } String mimeType = mostRecentFile.getMIMEType(); return JSUtils.JS_MIME_TYPE.equals(mimeType); }
public void showTooltip() { final JEditorPane ep = EditorContextDispatcher.getDefault().getMostRecentEditor(); final EditorUI eui = org.netbeans.editor.Utilities.getEditorUI(ep); final ToolTipSupport toolTipSupport = eui.getToolTipSupport(); toolTipSupport.setToolTip(this); }
public static String getJavaIdentifier () { JEditorPane ep = EditorContextDispatcher.getDefault().getCurrentEditor(); if (ep == null) { return null; } return getJavaIdentifier ( (StyledDocument) ep.getDocument (), ep, ep.getCaret ().getDot () ); }
public static boolean isInDisasm() { if (opened) { //TODO: optimize FileObject fobj = EditorContextDispatcher.getDefault().getCurrentFile(); if (fobj == null) { fobj = EditorContextDispatcher.getDefault().getMostRecentFile(); } if (fobj != null) { try { return DataObject.find(fobj).equals(getDataObject()); } catch(DataObjectNotFoundException doe) { Exceptions.printStackTrace(doe); } } } return false; }
@Override public Component getEditorComponent() { FileObject file = EditorContextDispatcher.getDefault().getMostRecentFile(); int line = EditorContextDispatcher.getDefault().getMostRecentLineNumber(); if (file != null && line != -1) { DialogBinding.bindComponentToFile(file, line, 0, 0, pane); } return pane; }
private boolean shouldBeEnabled () { if (editorContext.getCurrentLineNumber () < 0) { return false; FileObject fo = editorContext.getCurrentFile(); if (fo == null || !fo.hasExt("java")) { return false;
/** * Returns number of line currently selected in editor or <code>-1</code>. * * @return number of line currently selected in editor or <code>-1</code> */ public int getCurrentOffset() { JEditorPane ep = contextDispatcher.getCurrentEditor(); if (ep == null) { return -1; } Caret caret = ep.getCaret(); if (caret == null) { return -1; } return caret.getDot(); }
} else { setupContext(editorPane, null); Line line = EditorContextDispatcher.getDefault().getMostRecentLine(); line.createPart(0, 0);
@Override public void postAction(Object action, final Runnable actionPerformedNotifier) { final LineBreakpoint newBreakpoint = LineBreakpoint.create ( editorContext.getCurrentURLAsString(), editorContext.getCurrentLineNumber () ); RP.post(new Runnable() { @Override public void run() { // 1) set breakpoint removeBreakpoint (); createBreakpoint (newBreakpoint); try { SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { invokeAction(); } }); } catch (InterruptedException iex) { // Procceed } catch (java.lang.reflect.InvocationTargetException itex) { ErrorManager.getDefault().notify(itex); } finally { actionPerformedNotifier.run(); } } }); }
public static void addPropertyChangeListener(PropertyChangeListener l) { contextDispatcher.addPropertyChangeListener(MIMENames.C_MIME_TYPE, l); contextDispatcher.addPropertyChangeListener(MIMENames.CPLUSPLUS_MIME_TYPE, l); contextDispatcher.addPropertyChangeListener(MIMENames.HEADER_MIME_TYPE, l); contextDispatcher.addPropertyChangeListener(MIMENames.ASM_MIME_TYPE, l); contextDispatcher.addPropertyChangeListener(MIMENames.FORTRAN_MIME_TYPE, l); } }
public static FileObject getCurrentFileObject() { return contextDispatcher.getMostRecentFile(); }
/** * Returns number of line currently selected in editor or <code>-1</code>. * * @return number of line currently selected in editor or <code>-1</code> */ @Override public int getCurrentLineNumber () { return contextDispatcher.getCurrentLineNumber(); }
public static Line getCurrentLine() { FileObject fo = EditorContextDispatcher.getDefault().getCurrentFile(); if (fo == null) { return null; } if (!JS_MIME_TYPE.equalsIgnoreCase(fo.getMIMEType())) { return null; } return EditorContextDispatcher.getDefault().getCurrentLine(); }
@Override public boolean isDefault() { FileObject mostRecentFile = EditorContextDispatcher.getDefault().getMostRecentFile(); if (mostRecentFile == null) { return false; } String mimeType = mostRecentFile.getMIMEType(); return JSUtils.JS_MIME_TYPE.equals(mimeType); }