Search in sources :

Example 1 with PropertyDialogAction

use of org.eclipse.ui.dialogs.PropertyDialogAction in project translationstudio8 by heartsome.

the class PropertiesActionProvider method init.

public void init(final ICommonActionExtensionSite aSite) {
    delegateSelectionProvider = new DelegateSelectionProvider(aSite.getViewSite().getSelectionProvider());
    propertiesAction = new PropertyDialogAction(new IShellProvider() {

        public Shell getShell() {
            return aSite.getViewSite().getShell();
        }
    }, delegateSelectionProvider);
    propertiesAction.setText("属性");
    propertiesAction.setActionDefinitionId(IWorkbenchCommandConstants.FILE_PROPERTIES);
}
Also used : IShellProvider(org.eclipse.jface.window.IShellProvider) PropertyDialogAction(org.eclipse.ui.dialogs.PropertyDialogAction)

Example 2 with PropertyDialogAction

use of org.eclipse.ui.dialogs.PropertyDialogAction in project netxms by netxms.

the class ObjectContextMenu method fill.

/**
 * Fill default object context menu
 *
 * @param manager
 */
public static void fill(IMenuManager manager, IShellProvider shellProvider, ISelectionProvider selectionProvider) {
    manager.add(new GroupMarker(GroupMarkers.MB_OBJECT_CREATION));
    manager.add(new Separator());
    manager.add(new GroupMarker(GroupMarkers.MB_ATM));
    manager.add(new Separator());
    manager.add(new GroupMarker(GroupMarkers.MB_NXVS));
    manager.add(new Separator());
    manager.add(new GroupMarker(GroupMarkers.MB_OBJECT_MANAGEMENT));
    manager.add(new GroupMarker(GroupMarkers.MB_OBJECT_TOOLS));
    manager.add(new Separator());
    manager.add(new GroupMarker(GroupMarkers.MB_OBJECT_BINDING));
    manager.add(new Separator());
    manager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
    manager.add(new Separator());
    manager.add(new GroupMarker(GroupMarkers.MB_EVENTS_AND_LOGS));
    manager.add(new Separator());
    manager.add(new GroupMarker(GroupMarkers.MB_TOPOLOGY));
    manager.add(new Separator());
    manager.add(new GroupMarker(GroupMarkers.MB_DATA_COLLECTION));
    manager.add(new Separator());
    manager.add(new GroupMarker(GroupMarkers.MB_PROPERTIES));
    if ((shellProvider != null) && (selectionProvider != null) && (((IStructuredSelection) selectionProvider.getSelection()).size() == 1)) {
        PropertyDialogAction action = new PropertyDialogAction(shellProvider, selectionProvider);
        manager.add(action);
        action.setEnabled((selectionProvider.getSelection() instanceof IStructuredSelection) && (((IStructuredSelection) selectionProvider.getSelection()).size() == 1));
    }
}
Also used : GroupMarker(org.eclipse.jface.action.GroupMarker) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) Separator(org.eclipse.jface.action.Separator) PropertyDialogAction(org.eclipse.ui.dialogs.PropertyDialogAction)

Example 3 with PropertyDialogAction

use of org.eclipse.ui.dialogs.PropertyDialogAction in project eclipse.platform.text by eclipse.

the class AbstractTextEditor method createActions.

/**
 * Creates this editor's standard actions and connects them with the global
 * workbench actions.
 * <p>
 * Subclasses may extend.</p>
 */
protected void createActions() {
    ResourceAction action;
    setAction(IWorkbenchCommandConstants.EDIT_CUT, null);
    // $NON-NLS-1$
    action = new TextOperationAction(EditorMessages.getBundleForConstructedKeys(), "Editor.Cut.", this, ITextOperationTarget.CUT);
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.CUT_ACTION);
    action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_CUT);
    setAction(ITextEditorActionConstants.CUT, action);
    setAction(IWorkbenchCommandConstants.EDIT_COPY, null);
    // $NON-NLS-1$
    action = new TextOperationAction(EditorMessages.getBundleForConstructedKeys(), "Editor.Copy.", this, ITextOperationTarget.COPY, true);
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.COPY_ACTION);
    action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_COPY);
    setAction(ITextEditorActionConstants.COPY, action);
    setAction(IWorkbenchCommandConstants.EDIT_PASTE, null);
    // $NON-NLS-1$
    action = new TextOperationAction(EditorMessages.getBundleForConstructedKeys(), "Editor.Paste.", this, ITextOperationTarget.PASTE);
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.PASTE_ACTION);
    action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_PASTE);
    setAction(ITextEditorActionConstants.PASTE, action);
    // $NON-NLS-1$
    action = new TextOperationAction(EditorMessages.getBundleForConstructedKeys(), "Editor.Delete.", this, ITextOperationTarget.DELETE);
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.DELETE_ACTION);
    action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_DELETE);
    setAction(ITextEditorActionConstants.DELETE, action);
    // $NON-NLS-1$
    action = new DeleteLineAction(EditorMessages.getBundleForConstructedKeys(), "Editor.DeleteLine.", this, DeleteLineAction.WHOLE, false);
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.DELETE_LINE_ACTION);
    action.setActionDefinitionId(ITextEditorActionDefinitionIds.DELETE_LINE);
    setAction(ITextEditorActionConstants.DELETE_LINE, action);
    // $NON-NLS-1$
    action = new DeleteLineAction(EditorMessages.getBundleForConstructedKeys(), "Editor.CutLine.", this, DeleteLineAction.WHOLE, true);
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.CUT_LINE_ACTION);
    action.setActionDefinitionId(ITextEditorActionDefinitionIds.CUT_LINE);
    setAction(ITextEditorActionConstants.CUT_LINE, action);
    // $NON-NLS-1$
    action = new DeleteLineAction(EditorMessages.getBundleForConstructedKeys(), "Editor.DeleteLineToBeginning.", this, DeleteLineAction.TO_BEGINNING, false);
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.DELETE_LINE_TO_BEGINNING_ACTION);
    action.setActionDefinitionId(ITextEditorActionDefinitionIds.DELETE_LINE_TO_BEGINNING);
    setAction(ITextEditorActionConstants.DELETE_LINE_TO_BEGINNING, action);
    // $NON-NLS-1$
    action = new DeleteLineAction(EditorMessages.getBundleForConstructedKeys(), "Editor.CutLineToBeginning.", this, DeleteLineAction.TO_BEGINNING, true);
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.CUT_LINE_TO_BEGINNING_ACTION);
    action.setActionDefinitionId(ITextEditorActionDefinitionIds.CUT_LINE_TO_BEGINNING);
    setAction(ITextEditorActionConstants.CUT_LINE_TO_BEGINNING, action);
    // $NON-NLS-1$
    action = new DeleteLineAction(EditorMessages.getBundleForConstructedKeys(), "Editor.DeleteLineToEnd.", this, DeleteLineAction.TO_END, false);
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.DELETE_LINE_TO_END_ACTION);
    action.setActionDefinitionId(ITextEditorActionDefinitionIds.DELETE_LINE_TO_END);
    setAction(ITextEditorActionConstants.DELETE_LINE_TO_END, action);
    // $NON-NLS-1$
    action = new DeleteLineAction(EditorMessages.getBundleForConstructedKeys(), "Editor.CutLineToEnd.", this, DeleteLineAction.TO_END, true);
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.CUT_LINE_TO_END_ACTION);
    action.setActionDefinitionId(ITextEditorActionDefinitionIds.CUT_LINE_TO_END);
    setAction(ITextEditorActionConstants.CUT_LINE_TO_END, action);
    // $NON-NLS-1$ //$NON-NLS-2$
    action = new JoinLinesAction(EditorMessages.getBundleForConstructedKeys(), "Editor.JoinLines.", this, " ");
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.JOIN_LINES_ACTION);
    action.setActionDefinitionId(ITextEditorActionDefinitionIds.JOIN_LINES);
    setAction(ITextEditorActionConstants.JOIN_LINES, action);
    // $NON-NLS-1$
    action = new MarkAction(EditorMessages.getBundleForConstructedKeys(), "Editor.SetMark.", this, MarkAction.SET_MARK);
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.SET_MARK_ACTION);
    action.setActionDefinitionId(ITextEditorActionDefinitionIds.SET_MARK);
    setAction(ITextEditorActionConstants.SET_MARK, action);
    // $NON-NLS-1$
    action = new MarkAction(EditorMessages.getBundleForConstructedKeys(), "Editor.ClearMark.", this, MarkAction.CLEAR_MARK);
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.CLEAR_MARK_ACTION);
    action.setActionDefinitionId(ITextEditorActionDefinitionIds.CLEAR_MARK);
    setAction(ITextEditorActionConstants.CLEAR_MARK, action);
    // $NON-NLS-1$
    action = new MarkAction(EditorMessages.getBundleForConstructedKeys(), "Editor.SwapMark.", this, MarkAction.SWAP_MARK);
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.SWAP_MARK_ACTION);
    action.setActionDefinitionId(ITextEditorActionDefinitionIds.SWAP_MARK);
    setAction(ITextEditorActionConstants.SWAP_MARK, action);
    // $NON-NLS-1$
    action = new TextOperationAction(EditorMessages.getBundleForConstructedKeys(), "Editor.SelectAll.", this, ITextOperationTarget.SELECT_ALL, true);
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.SELECT_ALL_ACTION);
    action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_SELECT_ALL);
    setAction(ITextEditorActionConstants.SELECT_ALL, action);
    // $NON-NLS-1$
    action = new ShiftAction(EditorMessages.getBundleForConstructedKeys(), "Editor.ShiftRight.", this, ITextOperationTarget.SHIFT_RIGHT);
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.SHIFT_RIGHT_ACTION);
    action.setActionDefinitionId(ITextEditorActionDefinitionIds.SHIFT_RIGHT);
    setAction(ITextEditorActionConstants.SHIFT_RIGHT, action);
    action = new // $NON-NLS-1$
    ShiftAction(// $NON-NLS-1$
    EditorMessages.getBundleForConstructedKeys(), // $NON-NLS-1$
    "Editor.ShiftRight.", // $NON-NLS-1$
    this, // $NON-NLS-1$
    ITextOperationTarget.SHIFT_RIGHT) {

        @Override
        public void update() {
            updateForTab();
        }
    };
    setAction(ITextEditorActionConstants.SHIFT_RIGHT_TAB, action);
    // $NON-NLS-1$
    action = new ShiftAction(EditorMessages.getBundleForConstructedKeys(), "Editor.ShiftLeft.", this, ITextOperationTarget.SHIFT_LEFT);
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.SHIFT_LEFT_ACTION);
    action.setActionDefinitionId(ITextEditorActionDefinitionIds.SHIFT_LEFT);
    setAction(ITextEditorActionConstants.SHIFT_LEFT, action);
    // $NON-NLS-1$
    action = new TextOperationAction(EditorMessages.getBundleForConstructedKeys(), "Editor.Print.", this, ITextOperationTarget.PRINT, true);
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.PRINT_ACTION);
    action.setActionDefinitionId(IWorkbenchCommandConstants.FILE_PRINT);
    setAction(ITextEditorActionConstants.PRINT, action);
    // $NON-NLS-1$
    action = new FindReplaceAction(EditorMessages.getBundleForConstructedKeys(), "Editor.FindReplace.", this);
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.FIND_ACTION);
    action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_FIND_AND_REPLACE);
    setAction(ITextEditorActionConstants.FIND, action);
    // $NON-NLS-1$
    action = new FindNextAction(EditorMessages.getBundleForConstructedKeys(), "Editor.FindNext.", this, true);
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.FIND_NEXT_ACTION);
    action.setActionDefinitionId(IWorkbenchActionDefinitionIds.FIND_NEXT);
    setAction(ITextEditorActionConstants.FIND_NEXT, action);
    // $NON-NLS-1$
    action = new FindNextAction(EditorMessages.getBundleForConstructedKeys(), "Editor.FindPrevious.", this, false);
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.FIND_PREVIOUS_ACTION);
    action.setActionDefinitionId(IWorkbenchActionDefinitionIds.FIND_PREVIOUS);
    setAction(ITextEditorActionConstants.FIND_PREVIOUS, action);
    // $NON-NLS-1$
    action = new IncrementalFindAction(EditorMessages.getBundleForConstructedKeys(), "Editor.FindIncremental.", this, true);
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.FIND_INCREMENTAL_ACTION);
    action.setActionDefinitionId(IWorkbenchActionDefinitionIds.FIND_INCREMENTAL);
    setAction(ITextEditorActionConstants.FIND_INCREMENTAL, action);
    // $NON-NLS-1$
    action = new IncrementalFindAction(EditorMessages.getBundleForConstructedKeys(), "Editor.FindIncrementalReverse.", this, false);
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.FIND_INCREMENTAL_REVERSE_ACTION);
    action.setActionDefinitionId(IWorkbenchActionDefinitionIds.FIND_INCREMENTAL_REVERSE);
    setAction(ITextEditorActionConstants.FIND_INCREMENTAL_REVERSE, action);
    fSaveAction = ActionFactory.SAVE.create(getSite().getWorkbenchWindow());
    setAction(ITextEditorActionConstants.SAVE, fSaveAction);
    // $NON-NLS-1$
    action = new RevertToSavedAction(EditorMessages.getBundleForConstructedKeys(), "Editor.Revert.", this);
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.REVERT_TO_SAVED_ACTION);
    action.setActionDefinitionId(IWorkbenchCommandConstants.FILE_REVERT);
    setAction(ITextEditorActionConstants.REVERT_TO_SAVED, action);
    // $NON-NLS-1$
    action = new GotoLineAction(EditorMessages.getBundleForConstructedKeys(), "Editor.GotoLine.", this);
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.GOTO_LINE_ACTION);
    action.setActionDefinitionId(ITextEditorActionDefinitionIds.LINE_GOTO);
    setAction(ITextEditorActionConstants.GOTO_LINE, action);
    // $NON-NLS-1$
    action = new MoveLinesAction(EditorMessages.getBundleForConstructedKeys(), "Editor.MoveLinesUp.", this, getSourceViewer(), true, false);
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.MOVE_LINES_ACTION);
    action.setActionDefinitionId(ITextEditorActionDefinitionIds.MOVE_LINES_UP);
    setAction(ITextEditorActionConstants.MOVE_LINE_UP, action);
    // $NON-NLS-1$
    action = new MoveLinesAction(EditorMessages.getBundleForConstructedKeys(), "Editor.MoveLinesDown.", this, getSourceViewer(), false, false);
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.MOVE_LINES_ACTION);
    action.setActionDefinitionId(ITextEditorActionDefinitionIds.MOVE_LINES_DOWN);
    setAction(ITextEditorActionConstants.MOVE_LINE_DOWN, action);
    // $NON-NLS-1$
    action = new MoveLinesAction(EditorMessages.getBundleForConstructedKeys(), "Editor.CopyLineUp.", this, getSourceViewer(), true, true);
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.COPY_LINES_ACTION);
    action.setActionDefinitionId(ITextEditorActionDefinitionIds.COPY_LINES_UP);
    setAction(ITextEditorActionConstants.COPY_LINE_UP, action);
    // $NON-NLS-1$
    action = new MoveLinesAction(EditorMessages.getBundleForConstructedKeys(), "Editor.CopyLineDown.", this, getSourceViewer(), false, true);
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.COPY_LINES_ACTION);
    action.setActionDefinitionId(ITextEditorActionDefinitionIds.COPY_LINES_DOWN);
    setAction(ITextEditorActionConstants.COPY_LINE_DOWN, action);
    // $NON-NLS-1$
    action = new CaseAction(EditorMessages.getBundleForConstructedKeys(), "Editor.UpperCase.", this, true);
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.UPPER_CASE_ACTION);
    action.setActionDefinitionId(ITextEditorActionDefinitionIds.UPPER_CASE);
    setAction(ITextEditorActionConstants.UPPER_CASE, action);
    // $NON-NLS-1$
    action = new CaseAction(EditorMessages.getBundleForConstructedKeys(), "Editor.LowerCase.", this, false);
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.LOWER_CASE_ACTION);
    action.setActionDefinitionId(ITextEditorActionDefinitionIds.LOWER_CASE);
    setAction(ITextEditorActionConstants.LOWER_CASE, action);
    // $NON-NLS-1$
    action = new InsertLineAction(EditorMessages.getBundleForConstructedKeys(), "Editor.SmartEnter.", this, false);
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.SMART_ENTER_ACTION);
    action.setActionDefinitionId(ITextEditorActionDefinitionIds.SMART_ENTER);
    setAction(ITextEditorActionConstants.SMART_ENTER, action);
    // $NON-NLS-1$
    action = new InsertLineAction(EditorMessages.getBundleForConstructedKeys(), "Editor.SmartEnterInverse.", this, true);
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.SMART_ENTER_ACTION);
    action.setActionDefinitionId(ITextEditorActionDefinitionIds.SMART_ENTER_INVERSE);
    setAction(ITextEditorActionConstants.SMART_ENTER_INVERSE, action);
    // $NON-NLS-1$
    action = new ToggleInsertModeAction(EditorMessages.getBundleForConstructedKeys(), "Editor.ToggleInsertMode.");
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.TOGGLE_INSERT_MODE_ACTION);
    action.setActionDefinitionId(ITextEditorActionDefinitionIds.TOGGLE_INSERT_MODE);
    setAction(ITextEditorActionConstants.TOGGLE_INSERT_MODE, action);
    // $NON-NLS-1$
    action = new HippieCompleteAction(EditorMessages.getBundleForConstructedKeys(), "Editor.HippieCompletion.", this);
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.HIPPIE_COMPLETION_ACTION);
    action.setActionDefinitionId(ITextEditorActionDefinitionIds.HIPPIE_COMPLETION);
    setAction(ITextEditorActionConstants.HIPPIE_COMPLETION, action);
    // $NON-NLS-1$
    action = new ContentAssistAction(EditorMessages.getBundleForConstructedKeys(), "Editor.ContentAssistProposal.", this);
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.CONTENT_ASSIST_ACTION);
    action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
    setAction(ITextEditorActionConstants.CONTENT_ASSIST, action);
    markAsStateDependentAction(ITextEditorActionConstants.CONTENT_ASSIST, true);
    // $NON-NLS-1$
    action = new TextOperationAction(EditorMessages.getBundleForConstructedKeys(), "Editor.ContentAssistContextInformation.", this, ISourceViewer.CONTENTASSIST_CONTEXT_INFORMATION);
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.CONTENT_ASSIST_CONTEXT_INFORMATION_ACTION);
    action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_CONTEXT_INFORMATION);
    setAction(ITextEditorActionConstants.CONTENT_ASSIST_CONTEXT_INFORMATION, action);
    markAsStateDependentAction(ITextEditorActionConstants.CONTENT_ASSIST_CONTEXT_INFORMATION, true);
    // $NON-NLS-1$
    action = new TextOperationAction(EditorMessages.getBundleForConstructedKeys(), "Editor.QuickAssist.", this, ISourceViewer.QUICK_ASSIST);
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.QUICK_ASSIST_ACTION);
    action.setActionDefinitionId(ITextEditorActionDefinitionIds.QUICK_ASSIST);
    setAction(ITextEditorActionConstants.QUICK_ASSIST, action);
    markAsStateDependentAction(ITextEditorActionConstants.QUICK_ASSIST, true);
    action = new GotoAnnotationAction(this, true);
    setAction(ITextEditorActionConstants.NEXT, action);
    action = new GotoAnnotationAction(this, false);
    setAction(ITextEditorActionConstants.PREVIOUS, action);
    // $NON-NLS-1$
    action = new RecenterAction(EditorMessages.getBundleForConstructedKeys(), "Editor.Recenter.", this);
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.RECENTER_ACTION);
    action.setActionDefinitionId(ITextEditorActionDefinitionIds.RECENTER);
    setAction(ITextEditorActionConstants.RECENTER, action);
    // $NON-NLS-1$
    action = new ShowWhitespaceCharactersAction(EditorMessages.getBundleForConstructedKeys(), "Editor.ShowWhitespaceCharacters.", this, getPreferenceStore());
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.SHOW_WHITESPACE_CHARACTERS_ACTION);
    action.setActionDefinitionId(ITextEditorActionDefinitionIds.SHOW_WHITESPACE_CHARACTERS);
    setAction(ITextEditorActionConstants.SHOW_WHITESPACE_CHARACTERS, action);
    // $NON-NLS-1$
    action = new TextOperationAction(EditorMessages.getBundleForConstructedKeys(), "Editor.ShowInformation.", this, ISourceViewer.INFORMATION, true);
    // $NON-NLS-1$
    action = new InformationDispatchAction(EditorMessages.getBundleForConstructedKeys(), "Editor.ShowInformation.", (TextOperationAction) action);
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.SHOW_INFORMATION_ACTION);
    action.setActionDefinitionId(ITextEditorActionDefinitionIds.SHOW_INFORMATION);
    setAction(ITextEditorActionConstants.SHOW_INFORMATION, action);
    // $NON-NLS-1$
    final BlockSelectionModeToggleAction blockAction = new BlockSelectionModeToggleAction(EditorMessages.getBundleForConstructedKeys(), "Editor.ToggleBlockSelectionMode.", this);
    action = blockAction;
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.BLOCK_SELECTION_MODE_ACTION);
    action.setActionDefinitionId(ITextEditorActionDefinitionIds.BLOCK_SELECTION_MODE);
    setAction(ITextEditorActionConstants.BLOCK_SELECTION_MODE, action);
    if (isWordWrapSupported()) {
        // $NON-NLS-1$
        final WordWrapToggleAction wrapAction = new WordWrapToggleAction(EditorMessages.getBundleForConstructedKeys(), "Editor.ToggleWordWrap.", this, getInitialWordWrapStatus());
        action = wrapAction;
        action.setHelpContextId(IAbstractTextEditorHelpContextIds.WORD_WRAP_TOGGLE_ACTION);
        action.setActionDefinitionId(ITextEditorActionDefinitionIds.WORD_WRAP);
        setAction(ITextEditorActionConstants.WORD_WRAP, action);
        blockAction.addPropertyChangeListener(new IPropertyChangeListener() {

            @Override
            public void propertyChange(PropertyChangeEvent event) {
                if (IAction.CHECKED == event.getProperty() && Boolean.TRUE.equals(event.getNewValue())) {
                    wrapAction.setChecked(false);
                }
            }
        });
        wrapAction.addPropertyChangeListener(new IPropertyChangeListener() {

            @Override
            public void propertyChange(PropertyChangeEvent event) {
                if (IAction.CHECKED == event.getProperty() && Boolean.TRUE.equals(event.getNewValue())) {
                    blockAction.setChecked(false);
                }
            }
        });
    }
    // $NON-NLS-1$;
    action = new TextOperationAction(EditorMessages.getBundleForConstructedKeys(), "Editor.OpenHyperlink.", this, HyperlinkManager.OPEN_HYPERLINK, true);
    action.setHelpContextId(IAbstractTextEditorHelpContextIds.OPEN_HYPERLINK_ACTION);
    action.setActionDefinitionId(ITextEditorActionDefinitionIds.OPEN_HYPERLINK);
    setAction(ITextEditorActionConstants.OPEN_HYPERLINK, action);
    PropertyDialogAction openProperties = new PropertyDialogAction(new IShellProvider() {

        @Override
        public Shell getShell() {
            return getSite().getShell();
        }
    }, new ISelectionProvider() {

        @Override
        public void addSelectionChangedListener(ISelectionChangedListener listener) {
        }

        @Override
        public ISelection getSelection() {
            return new StructuredSelection(getEditorInput());
        }

        @Override
        public void removeSelectionChangedListener(ISelectionChangedListener listener) {
        }

        @Override
        public void setSelection(ISelection selection) {
        }
    });
    openProperties.setActionDefinitionId(IWorkbenchCommandConstants.FILE_PROPERTIES);
    setAction(ITextEditorActionConstants.PROPERTIES, openProperties);
    markAsContentDependentAction(ITextEditorActionConstants.UNDO, true);
    markAsContentDependentAction(ITextEditorActionConstants.REDO, true);
    markAsContentDependentAction(ITextEditorActionConstants.FIND, true);
    markAsContentDependentAction(ITextEditorActionConstants.FIND_NEXT, true);
    markAsContentDependentAction(ITextEditorActionConstants.FIND_PREVIOUS, true);
    markAsContentDependentAction(ITextEditorActionConstants.FIND_INCREMENTAL, true);
    markAsContentDependentAction(ITextEditorActionConstants.FIND_INCREMENTAL_REVERSE, true);
    markAsSelectionDependentAction(ITextEditorActionConstants.CUT, true);
    markAsSelectionDependentAction(ITextEditorActionConstants.COPY, true);
    markAsSelectionDependentAction(ITextEditorActionConstants.PASTE, true);
    markAsSelectionDependentAction(ITextEditorActionConstants.DELETE, true);
    markAsSelectionDependentAction(ITextEditorActionConstants.SHIFT_RIGHT, true);
    markAsSelectionDependentAction(ITextEditorActionConstants.SHIFT_RIGHT_TAB, true);
    markAsSelectionDependentAction(ITextEditorActionConstants.UPPER_CASE, true);
    markAsSelectionDependentAction(ITextEditorActionConstants.LOWER_CASE, true);
    markAsPropertyDependentAction(ITextEditorActionConstants.UNDO, true);
    markAsPropertyDependentAction(ITextEditorActionConstants.REDO, true);
    markAsPropertyDependentAction(ITextEditorActionConstants.REVERT_TO_SAVED, true);
    markAsPropertyDependentAction(ITextEditorActionConstants.SAVE, true);
    markAsStateDependentAction(ITextEditorActionConstants.UNDO, true);
    markAsStateDependentAction(ITextEditorActionConstants.REDO, true);
    markAsStateDependentAction(ITextEditorActionConstants.CUT, true);
    markAsStateDependentAction(ITextEditorActionConstants.PASTE, true);
    markAsStateDependentAction(ITextEditorActionConstants.DELETE, true);
    markAsStateDependentAction(ITextEditorActionConstants.SHIFT_RIGHT, true);
    markAsStateDependentAction(ITextEditorActionConstants.SHIFT_RIGHT_TAB, true);
    markAsStateDependentAction(ITextEditorActionConstants.SHIFT_LEFT, true);
    markAsStateDependentAction(ITextEditorActionConstants.FIND, true);
    markAsStateDependentAction(ITextEditorActionConstants.DELETE_LINE, true);
    markAsStateDependentAction(ITextEditorActionConstants.DELETE_LINE_TO_BEGINNING, true);
    markAsStateDependentAction(ITextEditorActionConstants.DELETE_LINE_TO_END, true);
    markAsStateDependentAction(ITextEditorActionConstants.MOVE_LINE_UP, true);
    markAsStateDependentAction(ITextEditorActionConstants.MOVE_LINE_DOWN, true);
    markAsStateDependentAction(ITextEditorActionConstants.CUT_LINE, true);
    markAsStateDependentAction(ITextEditorActionConstants.CUT_LINE_TO_BEGINNING, true);
    markAsStateDependentAction(ITextEditorActionConstants.CUT_LINE_TO_END, true);
    setActionActivationCode(ITextEditorActionConstants.SHIFT_RIGHT_TAB, '\t', -1, SWT.NONE);
    setActionActivationCode(ITextEditorActionConstants.SHIFT_LEFT, '\t', -1, SWT.SHIFT);
}
Also used : IShellProvider(org.eclipse.jface.window.IShellProvider) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) PropertyDialogAction(org.eclipse.ui.dialogs.PropertyDialogAction) Shell(org.eclipse.swt.widgets.Shell) ISelectionProvider(org.eclipse.jface.viewers.ISelectionProvider) ISelection(org.eclipse.jface.viewers.ISelection) IPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) PropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)

Example 4 with PropertyDialogAction

use of org.eclipse.ui.dialogs.PropertyDialogAction in project erlide_eclipse by erlang.

the class OpenViewActionGroup method createSiteActions.

private void createSiteActions(final ISelectionProvider specialProvider) {
    // fOpenSuperImplementation= new OpenSuperImplementationAction(site);
    // fOpenSuperImplementation.setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_SUPER_IMPLEMENTATION);
    // fOpenSuperImplementation.setSpecialSelectionProvider(specialProvider);
    // 
    // fOpenExternalJavadoc= new OpenExternalJavadocAction(site);
    // fOpenExternalJavadoc.setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_EXTERNAL_JAVADOC);
    // fOpenExternalJavadoc.setSpecialSelectionProvider(specialProvider);
    // 
    // fOpenTypeHierarchy= new OpenTypeHierarchyAction(site);
    // fOpenTypeHierarchy.setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_TYPE_HIERARCHY);
    // fOpenTypeHierarchy.setSpecialSelectionProvider(specialProvider);
    // 
    // fOpenCallHierarchy= new OpenCallHierarchyAction(site);
    // fOpenCallHierarchy.setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_CALL_HIERARCHY);
    // fOpenCallHierarchy.setSpecialSelectionProvider(specialProvider);
    final ISelectionProvider provider = specialProvider != null ? specialProvider : site.getSelectionProvider();
    fOpenPropertiesDialog = new PropertyDialogAction(site, provider);
    // $NON-NLS-1$
    fOpenPropertiesDialog.setActionDefinitionId("org.eclipse.ui.file.properties");
    initialize(provider);
}
Also used : ISelectionProvider(org.eclipse.jface.viewers.ISelectionProvider) PropertyDialogAction(org.eclipse.ui.dialogs.PropertyDialogAction)

Example 5 with PropertyDialogAction

use of org.eclipse.ui.dialogs.PropertyDialogAction in project erlide_eclipse by erlang.

the class ErlangBreakpointPropertiesAction method run.

/**
 * @see IActionDelegate#run(IAction)
 */
@Override
public void run(final IAction action) {
    if (fBreakpoint != null) {
        IShellProvider provider;
        if (fPart != null) {
            provider = fPart.getSite();
        } else {
            provider = new IShellProvider() {

                @Override
                public Shell getShell() {
                    final IWorkbench workbench = PlatformUI.getWorkbench();
                    final IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
                    return window == null ? null : window.getShell();
                }
            };
        }
        final PropertyDialogAction propertyAction = new PropertyDialogAction(provider, new ISelectionProvider() {

            @Override
            public void addSelectionChangedListener(final ISelectionChangedListener listener) {
            }

            @Override
            public ISelection getSelection() {
                return new StructuredSelection(fBreakpoint);
            }

            @Override
            public void removeSelectionChangedListener(final ISelectionChangedListener listener) {
            }

            @Override
            public void setSelection(final ISelection selection) {
            }
        });
        propertyAction.run();
    }
}
Also used : IShellProvider(org.eclipse.jface.window.IShellProvider) IWorkbench(org.eclipse.ui.IWorkbench) IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) Shell(org.eclipse.swt.widgets.Shell) ISelectionProvider(org.eclipse.jface.viewers.ISelectionProvider) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) ISelection(org.eclipse.jface.viewers.ISelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) PropertyDialogAction(org.eclipse.ui.dialogs.PropertyDialogAction)

Aggregations

PropertyDialogAction (org.eclipse.ui.dialogs.PropertyDialogAction)9 ISelectionProvider (org.eclipse.jface.viewers.ISelectionProvider)5 ISelection (org.eclipse.jface.viewers.ISelection)4 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)4 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)4 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)3 IShellProvider (org.eclipse.jface.window.IShellProvider)3 Action (org.eclipse.jface.action.Action)2 Shell (org.eclipse.swt.widgets.Shell)2 RefreshAction (org.netxms.ui.eclipse.actions.RefreshAction)2 GroupMarker (org.eclipse.jface.action.GroupMarker)1 Separator (org.eclipse.jface.action.Separator)1 ActionHandler (org.eclipse.jface.commands.ActionHandler)1 IPropertyChangeListener (org.eclipse.jface.util.IPropertyChangeListener)1 PropertyChangeEvent (org.eclipse.jface.util.PropertyChangeEvent)1 IWorkbench (org.eclipse.ui.IWorkbench)1 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)1 IHandlerService (org.eclipse.ui.handlers.IHandlerService)1 ObjectToolDetails (org.netxms.client.objecttools.ObjectToolDetails)1