protected void createActions() { super.createActions(); setAction(ITextEditorActionConstants.SAVE, null); setAction(ITextEditorActionConstants.REVERT_TO_SAVED, null); fSourceCopyAction= getAction(ITextEditorActionConstants.COPY); fSelectAllAction= getAction(ITextEditorActionConstants.SELECT_ALL); final ActionGroup group= new RefactorActionGroup(this, ITextEditorActionConstants.GROUP_EDIT, true); fActionGroups.addGroup(group); fContextMenuGroup= new CompositeActionGroup(new ActionGroup[] {group}); /* * 1GF82PL: ITPJUI:ALL - Need to be able to add bookmark to class file * * // replace default action with class file specific ones * * setAction(ITextEditorActionConstants.BOOKMARK, new AddClassFileMarkerAction("AddBookmark.", this, IMarker.BOOKMARK, true)); //$NON-NLS-1$ * setAction(ITextEditorActionConstants.ADD_TASK, new AddClassFileMarkerAction("AddTask.", this, IMarker.TASK, false)); //$NON-NLS-1$ * setAction(ITextEditorActionConstants.RULER_MANAGE_BOOKMARKS, new ClassFileMarkerRulerAction("ManageBookmarks.", getVerticalRuler(), this, IMarker.BOOKMARK, true)); //$NON-NLS-1$ * setAction(ITextEditorActionConstants.RULER_MANAGE_TASKS, new ClassFileMarkerRulerAction("ManageTasks.", getVerticalRuler(), this, IMarker.TASK, true)); //$NON-NLS-1$ */ }
@Override protected IJavaElement getElementAt(int offset) { if (getEditorInput() instanceof IClassFileEditorInput) { try { IClassFileEditorInput input= (IClassFileEditorInput) getEditorInput(); return input.getClassFile().getElementAt(offset); } catch (JavaModelException x) { } } return null; }
@Override protected IStatus run(IProgressMonitor monitor) { CompilationUnit ast= SharedASTProvider.getAST(getInputJavaElement(), SharedASTProvider.WAIT_YES, null); if (fOverrideIndicatorManager != null) fOverrideIndicatorManager.reconciled(ast, true, monitor); if (fSemanticManager != null) { SemanticHighlightingReconciler reconciler= fSemanticManager.getReconciler(); if (reconciler != null) reconciler.reconciled(ast, false, monitor); } if (isMarkingOccurrences()) installOccurrencesFinder(false); return Status.OK_STATUS; } };
/** * Default constructor. */ public ClassFileEditor() { setDocumentProvider(JavaPlugin.getDefault().getClassFileDocumentProvider()); setEditorContextMenuId("#ClassFileEditorContext"); //$NON-NLS-1$ setRulerContextMenuId("#ClassFileRulerContext"); //$NON-NLS-1$ setOutlinerContextMenuId("#ClassFileOutlinerContext"); //$NON-NLS-1$ // don't set help contextId, we install our own help context }
protected void doSetInput(IEditorInput input) throws CoreException { uninstallOccurrencesFinder(); input= transformEditorInput(input); if (!(input instanceof IClassFileEditorInput)) throw new CoreException(JavaUIStatus.createError( null)); JavaModelException e= probeInputForSource(input); if (e != null) { IClassFileEditorInput classFileEditorInput= (IClassFileEditorInput) input; IDocumentProvider documentProvider= getDocumentProvider(); if (documentProvider instanceof ClassFileDocumentProvider) ((ClassFileDocumentProvider) documentProvider).removeInputChangeListener(this); documentProvider= getDocumentProvider(); if (documentProvider instanceof ClassFileDocumentProvider) ((ClassFileDocumentProvider) documentProvider).addInputChangeListener(this); verifyInput(getEditorInput()); final IJavaElement inputElement= getInputJavaElement();
@Override protected void doSetInput(IEditorInput input) throws CoreException { uninstallOccurrencesFinder(); input= transformEditorInput(input); if (!(input instanceof IClassFileEditorInput)) { String inputClassName= input != null ? input.getClass().getName() : "null"; //$NON-NLS-1$ JavaModelException e= probeInputForSource(input); if (e != null) { IClassFileEditorInput classFileEditorInput= (IClassFileEditorInput) input; IDocumentProvider documentProvider= getDocumentProvider(); if (documentProvider instanceof ClassFileDocumentProvider) ((ClassFileDocumentProvider) documentProvider).removeInputChangeListener(this); documentProvider= getDocumentProvider(); if (documentProvider instanceof ClassFileDocumentProvider) ((ClassFileDocumentProvider) documentProvider).addInputChangeListener(this); verifyInput(getEditorInput()); installSemanticHighlighting();
IAction copyQualifiedName= getAction(IJavaEditorActionConstants.COPY_QUALIFIED_NAME); boolean wasUsingSourceCopyAction= fSourceCopyAction == getAction(ITextEditorActionConstants.COPY); setAction(ITextEditorActionConstants.COPY, copyAction); copyAction.setEnabled(fNoSourceTextWidget.getSelectionText().length() > 0); fNoSourceTextWidget.addSelectionListener(new SelectionListener() { setAction(ITextEditorActionConstants.SELECT_ALL, selectAllAction); copyAction.setEnabled(fNoSourceTextWidget.getSelectionText().length() > 0); copyQualifiedName.setEnabled(false); setAction(ITextEditorActionConstants.COPY, fSourceCopyAction); setAction(ITextEditorActionConstants.SELECT_ALL, fSelectAllAction); copyQualifiedName.setEnabled(true); IAction currentCopyAction= getAction(ITextEditorActionConstants.COPY); boolean isUsingSourceCopyAction= fSourceCopyAction == currentCopyAction; if (wasUsingSourceCopyAction != isUsingSourceCopyAction) { IActionBars actionBars= getEditorSite().getActionBars(); createNavigationActions(); } else { for (int i= 0; i < ACTION_MAP.length; i++) { IdMapEntry entry= ACTION_MAP[i]; actionBars.setGlobalActionHandler(entry.getActionId(), null); setAction(entry.getActionId(), null); actionBars.setGlobalActionHandler(ITextEditorActionConstants.SELECT_ALL, getAction(ITextEditorActionConstants.SELECT_ALL));
public void createPartControl(Composite parent) { fParent= new Composite(parent, SWT.NONE); fStackLayout= new StackLayout(); fParent.setLayout(fStackLayout); fViewerComposite= new Composite(fParent, SWT.NONE); fViewerComposite.setLayout(new FillLayout()); super.createPartControl(fViewerComposite); fStackLayout.topControl= fViewerComposite; fParent.layout(); try { verifyInput(getEditorInput()); } catch (CoreException e) { String title= JavaEditorMessages.ClassFileEditor_error_title; String message= JavaEditorMessages.ClassFileEditor_error_message; ExceptionHandler.handle(e, fParent.getShell(), title, message); } }
@Override public void editorContextMenuAboutToShow(IMenuManager menu) { super.editorContextMenuAboutToShow(menu); IAction action = getAction(IJavaEditorActionDefinitionIds.ANNOTATE_CLASS_FILE); if (action.isEnabled()) { menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, action); } ActionContext context= new ActionContext(getSelectionProvider().getSelection()); fContextMenuGroup.setContext(context); fContextMenuGroup.fillContextMenu(menu); fContextMenuGroup.setContext(null); }
@Override public void widgetSelected(SelectionEvent event) { Shell shell= getSite().getShell(); try { IClasspathEntry result= BuildPathDialogAccess.configureSourceAttachment(shell, entry, canEditEncoding); if (result != null) { applySourceAttachment(shell, result, jproject, containerPath, entry.getReferencingEntry() != null); verifyInput(getEditorInput()); } } catch (CoreException e) { String title= JavaEditorMessages.SourceAttachmentForm_error_title; String message= JavaEditorMessages.SourceAttachmentForm_error_message; ExceptionHandler.handle(e, shell, title, message); } }
@Override public void dispose() { // http://bugs.eclipse.org/bugs/show_bug.cgi?id=18510 IDocumentProvider documentProvider= getDocumentProvider(); if (documentProvider instanceof ClassFileDocumentProvider) ((ClassFileDocumentProvider) documentProvider).removeInputChangeListener(this); super.dispose(); }
public void editorContextMenuAboutToShow(IMenuManager menu) { super.editorContextMenuAboutToShow(menu); ActionContext context= new ActionContext(getSelectionProvider().getSelection()); fContextMenuGroup.setContext(context); fContextMenuGroup.fillContextMenu(menu); fContextMenuGroup.setContext(null); }
@Override protected void doSetInput(IEditorInput input) throws CoreException { uninstallOccurrencesFinder(); input= transformEditorInput(input); if (!(input instanceof IClassFileEditorInput)) { String inputClassName= input != null ? input.getClass().getName() : "null"; //$NON-NLS-1$ JavaModelException e= probeInputForSource(input); if (e != null) { IClassFileEditorInput classFileEditorInput= (IClassFileEditorInput) input; IDocumentProvider documentProvider= getDocumentProvider(); if (documentProvider instanceof ClassFileDocumentProvider) ((ClassFileDocumentProvider) documentProvider).removeInputChangeListener(this); documentProvider= getDocumentProvider(); if (documentProvider instanceof ClassFileDocumentProvider) ((ClassFileDocumentProvider) documentProvider).addInputChangeListener(this); verifyInput(getEditorInput()); installSemanticHighlighting();
/** * Default constructor. */ public ClassFileEditor() { setDocumentProvider(JavaPlugin.getDefault().getClassFileDocumentProvider()); setEditorContextMenuId("#ClassFileEditorContext"); //$NON-NLS-1$ setRulerContextMenuId("#ClassFileRulerContext"); //$NON-NLS-1$ setOutlinerContextMenuId("#ClassFileOutlinerContext"); //$NON-NLS-1$ // don't set help contextId, we install our own help context }
IAction copyQualifiedName= getAction(IJavaEditorActionConstants.COPY_QUALIFIED_NAME); IAction annotateAction= getAction(IJavaEditorActionDefinitionIds.ANNOTATE_CLASS_FILE); boolean wasUsingSourceCopyAction= fSourceCopyAction == getAction(ITextEditorActionConstants.COPY); setAction(ITextEditorActionConstants.COPY, copyAction); copyAction.setEnabled(fNoSourceTextWidget.getSelectionText().length() > 0); fNoSourceTextWidget.addSelectionListener(new SelectionListener() { setAction(ITextEditorActionConstants.SELECT_ALL, selectAllAction); copyAction.setEnabled(fNoSourceTextWidget.getSelectionText().length() > 0); copyQualifiedName.setEnabled(false); setAction(ITextEditorActionConstants.COPY, fSourceCopyAction); setAction(ITextEditorActionConstants.SELECT_ALL, fSelectAllAction); copyQualifiedName.setEnabled(true); IAction currentCopyAction= getAction(ITextEditorActionConstants.COPY); boolean isUsingSourceCopyAction= fSourceCopyAction == currentCopyAction; if (wasUsingSourceCopyAction != isUsingSourceCopyAction) { IActionBars actionBars= getEditorSite().getActionBars(); createNavigationActions(); } else { for (int i= 0; i < ACTION_MAP.length; i++) { IdMapEntry entry= ACTION_MAP[i]; actionBars.setGlobalActionHandler(entry.getActionId(), null); setAction(entry.getActionId(), null);
@Override public void createPartControl(Composite parent) { fParent= new Composite(parent, SWT.NONE); fStackLayout= new StackLayout(); fParent.setLayout(fStackLayout); fViewerComposite= new Composite(fParent, SWT.NONE); fViewerComposite.setLayout(new FillLayout()); super.createPartControl(fViewerComposite); fStackLayout.topControl= fViewerComposite; fParent.layout(); try { verifyInput(getEditorInput()); } catch (CoreException e) { String title= JavaEditorMessages.ClassFileEditor_error_title; String message= JavaEditorMessages.ClassFileEditor_error_message; ExceptionHandler.handle(e, fParent.getShell(), title, message); } }
@Override public void editorContextMenuAboutToShow(IMenuManager menu) { super.editorContextMenuAboutToShow(menu); IAction action = getAction(IJavaEditorActionDefinitionIds.ANNOTATE_CLASS_FILE); if (action.isEnabled()) { menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, action); } ActionContext context= new ActionContext(getSelectionProvider().getSelection()); fContextMenuGroup.setContext(context); fContextMenuGroup.fillContextMenu(menu); fContextMenuGroup.setContext(null); }
@Override public void widgetSelected(SelectionEvent event) { Shell shell= getSite().getShell(); try { IClasspathEntry result= BuildPathDialogAccess.configureSourceAttachment(shell, entry, canEditEncoding); if (result != null) { applySourceAttachment(shell, result, jproject, containerPath, entry.getReferencingEntry() != null); verifyInput(getEditorInput()); } } catch (CoreException e) { String title= JavaEditorMessages.SourceAttachmentForm_error_title; String message= JavaEditorMessages.SourceAttachmentForm_error_message; ExceptionHandler.handle(e, shell, title, message); } }
public void dispose() { // http://bugs.eclipse.org/bugs/show_bug.cgi?id=18510 IDocumentProvider documentProvider= getDocumentProvider(); if (documentProvider instanceof ClassFileDocumentProvider) ((ClassFileDocumentProvider) documentProvider).removeInputChangeListener(this); super.dispose(); }
/** * Default constructor. */ public ClassFileEditor() { super(); setDocumentProvider(JavaPlugin.getDefault().getClassFileDocumentProvider()); setEditorContextMenuId("#ClassFileEditorContext"); //$NON-NLS-1$ setRulerContextMenuId("#ClassFileRulerContext"); //$NON-NLS-1$ setOutlinerContextMenuId("#ClassFileOutlinerContext"); //$NON-NLS-1$ // don't set help contextId, we install our own help context }