本文整理汇总了Java中org.eclipse.ui.texteditor.ITextEditorActionConstants类的典型用法代码示例。如果您正苦于以下问题:Java ITextEditorActionConstants类的具体用法?Java ITextEditorActionConstants怎么用?Java ITextEditorActionConstants使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ITextEditorActionConstants类属于org.eclipse.ui.texteditor包,在下文中一共展示了ITextEditorActionConstants类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setActivePage
import org.eclipse.ui.texteditor.ITextEditorActionConstants; //导入依赖的package包/类
public void setActivePage(IEditorPart part) {
if (activeEditorPart == part)
return;
activeEditorPart = part;
IActionBars actionBars = getActionBars();
if (actionBars != null) {
ITextEditor editor = (part instanceof ITextEditor) ? (ITextEditor) part : null;
actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), getAction(editor, ITextEditorActionConstants.DELETE));
actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), getAction(editor, ITextEditorActionConstants.UNDO));
actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), getAction(editor, ITextEditorActionConstants.REDO));
actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(), getAction(editor, ITextEditorActionConstants.CUT));
actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), getAction(editor, ITextEditorActionConstants.COPY));
actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), getAction(editor, ITextEditorActionConstants.PASTE));
actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), getAction(editor, ITextEditorActionConstants.SELECT_ALL));
actionBars.setGlobalActionHandler(ActionFactory.FIND.getId(), getAction(editor, ITextEditorActionConstants.FIND));
actionBars.setGlobalActionHandler(IDEActionFactory.BOOKMARK.getId(), getAction(editor, IDEActionFactory.BOOKMARK.getId()));
actionBars.updateActionBars();
}
}
示例2: init
import org.eclipse.ui.texteditor.ITextEditorActionConstants; //导入依赖的package包/类
public void init(IActionBars bars) {
super.init(bars);
IMenuManager menuManager = bars.getMenuManager();
IMenuManager editMenu = menuManager
.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
if (editMenu != null) {
editMenu.add(new Separator());
editMenu.add(fContentAssistProposal);
editMenu.add(fContentFormat);
editMenu.add(fContentGotoLastEditPosition);
}
IToolBarManager toolBarManager = bars.getToolBarManager();
if (toolBarManager != null) {
toolBarManager.add(new Separator());
// toolBarManager.add(fTogglePresentation);
}
bars.getToolBarManager().remove(ITextEditorActionConstants.DELETE);
}
示例3: setSelection
import org.eclipse.ui.texteditor.ITextEditorActionConstants; //导入依赖的package包/类
/**
* Sets the current editor selection to the source range. Optionally sets the current editor
* position.
*
* @param range the source range to be shown in the editor, can be null.
* @param moveCursor if true the editor is scrolled to show the range.
*/
private void setSelection(ISourceRange range, boolean moveCursor) {
if (range == null) return;
try {
int start = range.getOffset();
int length = range.getLength();
setHighlightRange(start, length, moveCursor);
if (moveCursor) {
if (start > -1 && getSourceViewer() != null) {
getSourceViewer().revealRange(start, length);
// getSourceViewer().setSelectedRange(start, length);
}
updateStatusField(ITextEditorActionConstants.STATUS_CATEGORY_INPUT_POSITION);
}
return;
} catch (IllegalArgumentException e) {}
if (moveCursor) resetHighlightRange();
}
示例4: fillContextMenu
import org.eclipse.ui.texteditor.ITextEditorActionConstants; //导入依赖的package包/类
private void fillContextMenu(IMenuManager menu) {
menu.add(new GroupMarker(ITextEditorActionConstants.GROUP_UNDO));
menu.appendToGroup(ITextEditorActionConstants.GROUP_UNDO,
(IAction) fGlobalActions.get(ITextEditorActionConstants.UNDO));
menu.add(new Separator(ITextEditorActionConstants.GROUP_EDIT));
menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT,
(IAction) fGlobalActions.get(ITextEditorActionConstants.CUT));
menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT,
(IAction) fGlobalActions.get(ITextEditorActionConstants.COPY));
menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT,
(IAction) fGlobalActions.get(ITextEditorActionConstants.PASTE));
menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT,
(IAction) fGlobalActions.get(ITextEditorActionConstants.SELECT_ALL));
menu.add(new Separator(IContextMenuConstants.GROUP_GENERATE));
menu.appendToGroup(IContextMenuConstants.GROUP_GENERATE, (IAction) fGlobalActions.get("ContentAssistProposal")); //$NON-NLS-1$
}
示例5: setActionsActivated
import org.eclipse.ui.texteditor.ITextEditorActionConstants; //导入依赖的package包/类
@Override
protected void setActionsActivated(SourceViewer sourceViewer, boolean state) {
if (fEditor != null) {
Object editor = fEditor.get(sourceViewer);
if (editor instanceof TypeScriptEditorAdapter) {
TypeScriptEditorAdapter cuea = (TypeScriptEditorAdapter) editor;
cuea.setActionsActivated(state);
IAction saveAction = cuea.getAction(ITextEditorActionConstants.SAVE);
if (saveAction instanceof IPageListener) {
PartEventAction partEventAction = (PartEventAction) saveAction;
IWorkbenchPart compareEditorPart = getCompareConfiguration().getContainer().getWorkbenchPart();
if (state)
partEventAction.partActivated(compareEditorPart);
else
partEventAction.partDeactivated(compareEditorPart);
}
}
}
}
示例6: setActionsActivated
import org.eclipse.ui.texteditor.ITextEditorActionConstants; //导入依赖的package包/类
@Override
protected void setActionsActivated(SourceViewer sourceViewer, boolean state) {
DefaultMergeEditor mergeEditor = getEditor(sourceViewer);
if (mergeEditor != null) {
mergeEditor.setActionsActivated(state);
IAction saveAction = mergeEditor.getAction(ITextEditorActionConstants.SAVE);
if (saveAction instanceof IPageListener) {
PartEventAction partEventAction = (PartEventAction) saveAction;
IWorkbenchPart compareEditorPart = getCompareConfiguration().getContainer().getWorkbenchPart();
if (state) {
partEventAction.partActivated(compareEditorPart);
} else {
partEventAction.partDeactivated(compareEditorPart);
}
}
}
}
示例7: installUndoRedoSupport
import org.eclipse.ui.texteditor.ITextEditorActionConstants; //导入依赖的package包/类
protected OperationHistoryListener installUndoRedoSupport(SourceViewer viewer, IDocument document, final EmbeddedEditorActions actions) {
IDocumentUndoManager undoManager = DocumentUndoManagerRegistry.getDocumentUndoManager(document);
final IUndoContext context = undoManager.getUndoContext();
// XXX cp uncommented
// IOperationHistory operationHistory = PlatformUI.getWorkbench().getOperationSupport().getOperationHistory();
OperationHistoryListener operationHistoryListener = new OperationHistoryListener(context, new IUpdate() {
public void update() {
actions.updateAction(ITextEditorActionConstants.REDO);
actions.updateAction(ITextEditorActionConstants.UNDO);
}
});
viewer.addTextListener(new ITextListener() {
public void textChanged(TextEvent event) {
actions.updateAction(ITextEditorActionConstants.REDO);
actions.updateAction(ITextEditorActionConstants.UNDO);
}
});
//
// operationHistory.addOperationHistoryListener(operationHistoryListener);
return operationHistoryListener;
}
示例8: rulerContextMenuAboutToShow
import org.eclipse.ui.texteditor.ITextEditorActionConstants; //导入依赖的package包/类
@Override
protected void rulerContextMenuAboutToShow(final IMenuManager menu) {
super.rulerContextMenuAboutToShow(menu);
menu.remove("projection");
final IMenuManager foldingMenu = new MenuManager(XtextUIMessages.Editor_FoldingMenu_name, "projection"); //$NON-NLS-1$
menu.appendToGroup(ITextEditorActionConstants.GROUP_RULERS, foldingMenu);
IAction action = getAction("FoldingToggle"); //$NON-NLS-1$
foldingMenu.add(action);
action = getAction("FoldingExpandAll"); //$NON-NLS-1$
foldingMenu.add(action);
action = getAction("FoldingCollapseAll"); //$NON-NLS-1$
foldingMenu.add(action);
action = getAction("FoldingCollapseStrings"); //$NON-NLS-1$
foldingMenu.add(action);
action = getAction("FoldingRestore"); //$NON-NLS-1$
foldingMenu.add(action);
}
示例9: updateFindBarAction
import org.eclipse.ui.texteditor.ITextEditorActionConstants; //导入依赖的package包/类
/**
* Updates the find bar action (sets it as the Aptana find bar or restores the original one).
*/
private void updateFindBarAction()
{
IPreferenceStore preferenceStore = FindBarPlugin.getDefault().getPreferenceStore();
boolean useCustomFindBar = preferenceStore.getBoolean(IPreferencesConstants.USE_CUSTOM_FIND_BAR);
if (useCustomFindBar)
{
// Replaces the actual find with our find.
textEditor.setAction(ITextEditorActionConstants.FIND, new ShowFindBarAction(textEditor));
}
else
{
// Restore the original find action.
textEditor.setAction(ITextEditorActionConstants.FIND, fOriginalFindBarAction);
}
}
示例10: contributeToStatusLine
import org.eclipse.ui.texteditor.ITextEditorActionConstants; //导入依赖的package包/类
@Override
public void contributeToStatusLine(IStatusLineManager statusLineManager) {
commandsMenuContributionItem = new CommandsMenuContributionItem();
statusLineManager.add(commandsMenuContributionItem);
super.contributeToStatusLine(statusLineManager);
inputPositionStatsContributionItem = new StatusLineContributionItem(ITextEditorActionConstants.STATUS_CATEGORY_INPUT_POSITION, true, 24);
IContributionItem[] contributionItems = statusLineManager.getItems();
for (IContributionItem contributionItem : contributionItems) {
String id = contributionItem.getId();
if (ITextEditorActionConstants.STATUS_CATEGORY_INPUT_POSITION.equals(id)) {
statusLineManager.remove(contributionItem);
statusLineManager.add(inputPositionStatsContributionItem);
}
}
}
示例11: setActiveEditor
import org.eclipse.ui.texteditor.ITextEditorActionConstants; //导入依赖的package包/类
@Override
public void setActiveEditor(IEditorPart part) {
super.setActiveEditor(part);
if (part instanceof ITextEditor) {
ITextEditor textEditor = (ITextEditor) part;
if (commandsMenuContributionItem != null) {
commandsMenuContributionItem.setTextEditor(textEditor);
}
if (inputPositionStatsContributionItem != null) {
inputPositionStatsContributionItem.setActionHandler(getAction(textEditor, ITextEditorActionConstants.GOTO_LINE));
ITextEditorExtension extension = (ITextEditorExtension) textEditor;
extension.setStatusField(inputPositionStatsContributionItem, ITextEditorActionConstants.STATUS_CATEGORY_INPUT_POSITION);
}
if (part instanceof AbstractThemeableEditor) {
FoldingActionsGroup foldingActions = ((AbstractThemeableEditor) part).getFoldingActionsGroup();
if (foldingActions != null) {
foldingActions.updateActionBars();
}
}
markOccurrencesAction.setEditor(textEditor);
}
}
示例12: ImplementorsSearchGroup
import org.eclipse.ui.texteditor.ITextEditorActionConstants; //导入依赖的package包/类
/**
* Note: This constructor is for internal use only. Clients should not call this constructor.
* @param editor the Java editor
*
* @noreference This constructor is not intended to be referenced by clients.
*/
public ImplementorsSearchGroup(JavaEditor editor) {
fEditor= editor;
fSite= fEditor.getSite();
fGroupId= ITextEditorActionConstants.GROUP_FIND;
fFindImplementorsAction= new FindImplementorsAction(fEditor);
fFindImplementorsAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_IMPLEMENTORS_IN_WORKSPACE);
fEditor.setAction("SearchImplementorsInWorkspace", fFindImplementorsAction); //$NON-NLS-1$
fFindImplementorsInProjectAction= new FindImplementorsInProjectAction(fEditor);
fFindImplementorsInProjectAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_IMPLEMENTORS_IN_PROJECT);
fEditor.setAction("SearchImplementorsInProject", fFindImplementorsInProjectAction); //$NON-NLS-1$
fFindImplementorsInWorkingSetAction= new FindImplementorsInWorkingSetAction(fEditor);
fFindImplementorsInWorkingSetAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_IMPLEMENTORS_IN_WORKING_SET);
fEditor.setAction("SearchImplementorsInWorkingSet", fFindImplementorsInWorkingSetAction); //$NON-NLS-1$
}
示例13: WriteReferencesSearchGroup
import org.eclipse.ui.texteditor.ITextEditorActionConstants; //导入依赖的package包/类
/**
* Note: This constructor is for internal use only. Clients should not call this constructor.
* @param editor the Java editor
*
* @noreference This constructor is not intended to be referenced by clients.
*/
public WriteReferencesSearchGroup(JavaEditor editor) {
fEditor= editor;
fSite= fEditor.getSite();
fGroupId= ITextEditorActionConstants.GROUP_FIND;
fFindWriteReferencesAction= new FindWriteReferencesAction(fEditor);
fFindWriteReferencesAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_WRITE_ACCESS_IN_WORKSPACE);
fEditor.setAction("SearchWriteAccessInWorkspace", fFindWriteReferencesAction); //$NON-NLS-1$
fFindWriteReferencesInProjectAction= new FindWriteReferencesInProjectAction(fEditor);
fFindWriteReferencesInProjectAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_WRITE_ACCESS_IN_PROJECT);
fEditor.setAction("SearchWriteAccessInProject", fFindWriteReferencesInProjectAction); //$NON-NLS-1$
fFindWriteReferencesInHierarchyAction= new FindWriteReferencesInHierarchyAction(fEditor);
fFindWriteReferencesInHierarchyAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_WRITE_ACCESS_IN_HIERARCHY);
fEditor.setAction("SearchWriteAccessInHierarchy", fFindWriteReferencesInHierarchyAction); //$NON-NLS-1$
fFindWriteReferencesInWorkingSetAction= new FindWriteReferencesInWorkingSetAction(fEditor);
fFindWriteReferencesInWorkingSetAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_WRITE_ACCESS_IN_WORKING_SET);
fEditor.setAction("SearchWriteAccessInWorkingSet", fFindWriteReferencesInWorkingSetAction); //$NON-NLS-1$
}
示例14: DeclarationsSearchGroup
import org.eclipse.ui.texteditor.ITextEditorActionConstants; //导入依赖的package包/类
/**
* Note: This constructor is for internal use only. Clients should not call this constructor.
*
* @param editor the Java editor
*
* @noreference This constructor is not intended to be referenced by clients.
*/
public DeclarationsSearchGroup(JavaEditor editor) {
Assert.isNotNull(editor);
fEditor= editor;
fSite= fEditor.getSite();
fGroupId= ITextEditorActionConstants.GROUP_FIND;
fFindDeclarationsAction= new FindDeclarationsAction(fEditor);
fFindDeclarationsAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_DECLARATIONS_IN_WORKSPACE);
fEditor.setAction("SearchDeclarationsInWorkspace", fFindDeclarationsAction); //$NON-NLS-1$
fFindDeclarationsInProjectAction= new FindDeclarationsInProjectAction(fEditor);
fFindDeclarationsInProjectAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_DECLARATIONS_IN_PROJECTS);
fEditor.setAction("SearchDeclarationsInProjects", fFindDeclarationsInProjectAction); //$NON-NLS-1$
fFindDeclarationsInHierarchyAction= new FindDeclarationsInHierarchyAction(fEditor);
fFindDeclarationsInHierarchyAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_DECLARATIONS_IN_HIERARCHY);
fEditor.setAction("SearchDeclarationsInHierarchy", fFindDeclarationsInHierarchyAction); //$NON-NLS-1$
fFindDeclarationsInWorkingSetAction= new FindDeclarationsInWorkingSetAction(fEditor);
fFindDeclarationsInWorkingSetAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_DECLARATIONS_IN_WORKING_SET);
fEditor.setAction("SearchDeclarationsInWorkingSet", fFindDeclarationsInWorkingSetAction); //$NON-NLS-1$
}
示例15: ReadReferencesSearchGroup
import org.eclipse.ui.texteditor.ITextEditorActionConstants; //导入依赖的package包/类
/**
* Note: This constructor is for internal use only. Clients should not call this constructor.
* @param editor the Java editor
*
* @noreference This constructor is not intended to be referenced by clients.
*/
public ReadReferencesSearchGroup(JavaEditor editor) {
fEditor= editor;
fSite= fEditor.getSite();
fGroupId= ITextEditorActionConstants.GROUP_FIND;
fFindReadReferencesAction= new FindReadReferencesAction(fEditor);
fFindReadReferencesAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_WRITE_ACCESS_IN_WORKSPACE);
fEditor.setAction("SearchReadAccessInWorkspace", fFindReadReferencesAction); //$NON-NLS-1$
fFindReadReferencesInProjectAction= new FindReadReferencesInProjectAction(fEditor);
fFindReadReferencesInProjectAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_READ_ACCESS_IN_PROJECT);
fEditor.setAction("SearchReadAccessInProject", fFindReadReferencesInProjectAction); //$NON-NLS-1$
fFindReadReferencesInHierarchyAction= new FindReadReferencesInHierarchyAction(fEditor);
fFindReadReferencesInHierarchyAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_WRITE_ACCESS_IN_HIERARCHY);
fEditor.setAction("SearchReadAccessInHierarchy", fFindReadReferencesInHierarchyAction); //$NON-NLS-1$
fFindReadReferencesInWorkingSetAction= new FindReadReferencesInWorkingSetAction(fEditor);
fFindReadReferencesInWorkingSetAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_WRITE_ACCESS_IN_WORKING_SET);
fEditor.setAction("SearchReadAccessInWorkingSet", fFindReadReferencesInWorkingSetAction); //$NON-NLS-1$
}