Search in sources :

Example 1 with LinkToEditorAction

use of com.archimatetool.editor.views.tree.actions.LinkToEditorAction in project archi by archimatetool.

the class TreeModelView method makeActions.

/**
 * Make local actions
 */
private void makeActions() {
    IWorkbenchWindow window = getViewSite().getWorkbenchWindow();
    fActionNewModel = new NewArchimateModelAction();
    fActionOpenModel = new OpenModelAction(window);
    fActionOpenDiagram = new OpenDiagramAction(getSelectionProvider());
    fActionCloseModel = new CloseModelAction(getSelectionProvider());
    fActionSaveModel = new SaveModelAction(this);
    fActionDelete = new DeleteAction(getViewer());
    fActionRename = new RenameAction(getViewer());
    fActionFindReplace = new FindReplaceAction(this);
    fActionProperties = new PropertiesAction(getSelectionProvider());
    fActionLinkToEditor = new LinkToEditorAction();
    fActionNewFolder = new NewFolderAction(getSelectionProvider());
    fActionDuplicate = new DuplicateAction(getViewer());
    fActionGenerateView = new GenerateViewAction(getSelectionProvider());
    fActionToggleSearchField = new // $NON-NLS-1$
    Action(// $NON-NLS-1$
    "", // $NON-NLS-1$
    IAction.AS_CHECK_BOX) {

        @Override
        public void run() {
            if (isChecked()) {
                showSearchWidget();
            } else {
                hideSearchWidget();
            }
        }
    };
    fActionToggleSearchField.setToolTipText(Messages.TreeModelView_0);
    fActionToggleSearchField.setImageDescriptor(IArchiImages.ImageFactory.getImageDescriptor(IArchiImages.ICON_SEARCH));
    fActionCollapseSelected = new Action(Messages.TreeModelView_3) {

        @Override
        public void run() {
            IStructuredSelection selection = ((IStructuredSelection) getViewer().getSelection());
            for (Object o : selection.toArray()) {
                if (fTreeViewer.isExpandable(o) && fTreeViewer.getExpandedState(o)) {
                    fTreeViewer.collapseToLevel(o, AbstractTreeViewer.ALL_LEVELS);
                }
            }
        }

        @Override
        public ImageDescriptor getImageDescriptor() {
            return IArchiImages.ImageFactory.getImageDescriptor(IArchiImages.ICON_COLLAPSEALL);
        }
    };
    fActionExpandSelected = new Action(Messages.TreeModelView_4) {

        @Override
        public void run() {
            IStructuredSelection selection = ((IStructuredSelection) getViewer().getSelection());
            for (Object o : selection.toArray()) {
                if (hasExpandableNodes(o)) {
                    fTreeViewer.expandToLevel(o, AbstractTreeViewer.ALL_LEVELS);
                }
            }
        }

        @Override
        public ImageDescriptor getImageDescriptor() {
            return IArchiImages.ImageFactory.getImageDescriptor(IArchiImages.ICON_EXPANDALL);
        }
    };
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) NewArchimateModelAction(com.archimatetool.editor.actions.NewArchimateModelAction) DuplicateAction(com.archimatetool.editor.views.tree.actions.DuplicateAction) IAction(org.eclipse.jface.action.IAction) IViewerAction(com.archimatetool.editor.views.tree.actions.IViewerAction) OpenModelAction(com.archimatetool.editor.actions.OpenModelAction) DeleteAction(com.archimatetool.editor.views.tree.actions.DeleteAction) GenerateViewAction(com.archimatetool.editor.views.tree.actions.GenerateViewAction) PropertiesAction(com.archimatetool.editor.views.tree.actions.PropertiesAction) NewFolderAction(com.archimatetool.editor.views.tree.actions.NewFolderAction) CloseModelAction(com.archimatetool.editor.views.tree.actions.CloseModelAction) SaveModelAction(com.archimatetool.editor.views.tree.actions.SaveModelAction) RenameAction(com.archimatetool.editor.views.tree.actions.RenameAction) LinkToEditorAction(com.archimatetool.editor.views.tree.actions.LinkToEditorAction) FindReplaceAction(com.archimatetool.editor.views.tree.actions.FindReplaceAction) Action(org.eclipse.jface.action.Action) NewArchimateModelAction(com.archimatetool.editor.actions.NewArchimateModelAction) OpenDiagramAction(com.archimatetool.editor.views.tree.actions.OpenDiagramAction) CloseModelAction(com.archimatetool.editor.views.tree.actions.CloseModelAction) FindReplaceAction(com.archimatetool.editor.views.tree.actions.FindReplaceAction) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) NewFolderAction(com.archimatetool.editor.views.tree.actions.NewFolderAction) PropertiesAction(com.archimatetool.editor.views.tree.actions.PropertiesAction) LinkToEditorAction(com.archimatetool.editor.views.tree.actions.LinkToEditorAction) SaveModelAction(com.archimatetool.editor.views.tree.actions.SaveModelAction) OpenModelAction(com.archimatetool.editor.actions.OpenModelAction) DeleteAction(com.archimatetool.editor.views.tree.actions.DeleteAction) GenerateViewAction(com.archimatetool.editor.views.tree.actions.GenerateViewAction) IArchimateModelObject(com.archimatetool.model.IArchimateModelObject) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) RenameAction(com.archimatetool.editor.views.tree.actions.RenameAction) OpenDiagramAction(com.archimatetool.editor.views.tree.actions.OpenDiagramAction) DuplicateAction(com.archimatetool.editor.views.tree.actions.DuplicateAction)

Aggregations

NewArchimateModelAction (com.archimatetool.editor.actions.NewArchimateModelAction)1 OpenModelAction (com.archimatetool.editor.actions.OpenModelAction)1 CloseModelAction (com.archimatetool.editor.views.tree.actions.CloseModelAction)1 DeleteAction (com.archimatetool.editor.views.tree.actions.DeleteAction)1 DuplicateAction (com.archimatetool.editor.views.tree.actions.DuplicateAction)1 FindReplaceAction (com.archimatetool.editor.views.tree.actions.FindReplaceAction)1 GenerateViewAction (com.archimatetool.editor.views.tree.actions.GenerateViewAction)1 IViewerAction (com.archimatetool.editor.views.tree.actions.IViewerAction)1 LinkToEditorAction (com.archimatetool.editor.views.tree.actions.LinkToEditorAction)1 NewFolderAction (com.archimatetool.editor.views.tree.actions.NewFolderAction)1 OpenDiagramAction (com.archimatetool.editor.views.tree.actions.OpenDiagramAction)1 PropertiesAction (com.archimatetool.editor.views.tree.actions.PropertiesAction)1 RenameAction (com.archimatetool.editor.views.tree.actions.RenameAction)1 SaveModelAction (com.archimatetool.editor.views.tree.actions.SaveModelAction)1 IArchimateModelObject (com.archimatetool.model.IArchimateModelObject)1 Action (org.eclipse.jface.action.Action)1 IAction (org.eclipse.jface.action.IAction)1 ImageDescriptor (org.eclipse.jface.resource.ImageDescriptor)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)1