Example usage for org.eclipse.jface.action IAction AS_PUSH_BUTTON

List of usage examples for org.eclipse.jface.action IAction AS_PUSH_BUTTON

Introduction

In this page you can find the example usage for org.eclipse.jface.action IAction AS_PUSH_BUTTON.

Prototype

int AS_PUSH_BUTTON

To view the source code for org.eclipse.jface.action IAction AS_PUSH_BUTTON.

Click Source Link

Document

Action style constant (value 1) indicating action is a simple push button.

Usage

From source file:at.bestsolution.eclipse.properties.PropertyContentOutlinePage.java

License:Open Source License

@Override
public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager,
        IStatusLineManager statusLineManager) {
    super.makeContributions(menuManager, toolBarManager, statusLineManager);
    toolBarManager.add(hierarchicalAction);
    toolBarManager.add(sortAction);//from w ww.j  a v a2  s .  c  om

    Action a = new Action("", IAction.AS_PUSH_BUTTON) {
        @Override
        public void run() {
            try {
                getTreeViewer().getTree().setRedraw(false);
                getTreeViewer().collapseAll();
            } finally {
                getTreeViewer().getTree().setRedraw(true);
            }
        }
    };
    a.setImageDescriptor(Activator.getDefault().getImageRegistry().getDescriptor(Activator.COLLAPSE_ICON));
    toolBarManager.add(a);
}

From source file:at.bestsolution.efxclipse.tooling.jdt.ui.internal.editors.outline.PropertyContentOutlinePage.java

License:Open Source License

@Override
public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager,
        IStatusLineManager statusLineManager) {
    super.makeContributions(menuManager, toolBarManager, statusLineManager);
    toolBarManager.add(hierarchicalAction);
    toolBarManager.add(sortAction);//from  w w  w  .  j  av  a  2  s  .  c  o  m

    Action a = new Action("", IAction.AS_PUSH_BUTTON) {
        @Override
        public void run() {
            try {
                getTreeViewer().getTree().setRedraw(false);
                getTreeViewer().collapseAll();
            } finally {
                getTreeViewer().getTree().setRedraw(true);
            }
        }
    };
    a.setImageDescriptor(
            JavaFXUIPlugin.getDefault().getImageRegistry().getDescriptor(JavaFXUIPlugin.COLLAPSE_ICON));
    toolBarManager.add(a);
}

From source file:ca.uvic.cs.tagsea.ui.views.FilterComposite.java

License:Open Source License

/**
 * Creates the textbox and clear button which is tied to the given
 * TreeViewer.  Also adds listeners to the textbox so that when the 
 * enter or down arrow key is pressed the tree view gets focus.
 * The tree filter is also added to the tree viewer.
 * @param treeViewer//  ww  w . j a va 2s.  co m
 */
public void createTextFilterControl(TreeViewer treeViewer) {
    this.treeViewer = treeViewer;

    treeViewer.addFilter(treeFilter);
    this.text = new Text(this, SWT.SINGLE | SWT.BORDER);
    text.setText(INITIAL_TEXT);
    text.setToolTipText("Tags Filter");
    GridData data = new GridData(SWT.LEFT, SWT.FILL, false, false);
    data.widthHint = 80;
    text.setLayoutData(data);
    text.pack();
    originalTextColor = text.getForeground();

    // create the clear text button
    this.clearTextAction = new Action("", IAction.AS_PUSH_BUTTON) {
        public void run() {
            text.setText("");
            text.setFocus();
        }
    };
    clearTextAction.setToolTipText("Clear the filter text");
    final ImageDescriptor clearDescriptor = TagSEAPlugin.getDefault().getTagseaImages()
            .getDescriptor(ITagseaImages.IMG_CLEAR);
    final ImageDescriptor clearDescriptorDisabled = TagSEAPlugin.getDefault().getTagseaImages()
            .getDescriptor(ITagseaImages.IMG_CLEAR_DISABLED);
    clearTextAction.setImageDescriptor(clearDescriptor);
    clearTextAction.setDisabledImageDescriptor(clearDescriptorDisabled);
    ToolBar toolBar = new ToolBar(this, SWT.FLAT | SWT.HORIZONTAL);
    ToolBarManager manager = new ToolBarManager(toolBar);
    manager.add(clearTextAction);
    manager.update(false);

    Label spacer = new Label(this, SWT.NONE);
    data = new GridData(SWT.LEFT, SWT.FILL, false, false);
    data.widthHint = 8;
    spacer.setLayoutData(data);

    // add the textbox listeners
    text.addModifyListener(this);
    text.addKeyListener(this);
    text.addFocusListener(this);
}

From source file:cc.frz.ecl.filterpackageexplorer.FilterPackageExplorer.java

License:Open Source License

/**
 * Create the button that clears the text.
 * //ww w  . ja v a  2 s.  c  o m
 * @param parent
 *            parent <code>Composite</code> of toolbar button
 */
private void createClearText(Composite parent) {
    filterToolBar = new ToolBarManager(SWT.FLAT | SWT.HORIZONTAL);
    ToolBar control = filterToolBar.createControl(parent);
    control.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));

    IAction clearTextAction = new Action("", IAction.AS_PUSH_BUTTON) {//$NON-NLS-1$
        /*
         * (non-Javadoc)
         * 
         * @see org.eclipse.jface.action.Action#run()
         */
        public void run() {
            filtertext.setText("");
            updateTree();
        }
    };

    clearTextAction.setToolTipText(WorkbenchMessages.FilteredTree_ClearToolTip);
    clearTextAction.setImageDescriptor(JFaceResources.getImageRegistry().getDescriptor(CLEAR_ICON));
    clearTextAction.setDisabledImageDescriptor(JFaceResources.getImageRegistry().getDescriptor(DCLEAR_ICON));
    filterToolBar.add(clearTextAction);

    filterToolBar.update(false);
}

From source file:ch.elexis.core.ui.laboratory.views.LaborOrderPulldownMenuCreator.java

License:Open Source License

/**
 * Returns action to the pulldown button
 * //from ww w  .ja  v  a  2  s  . c  o m
 * @return
 */
public IAction getAction() {
    int buttonStyle = IAction.AS_DROP_DOWN_MENU;
    if (actions.size() == 1) {
        buttonStyle = IAction.AS_PUSH_BUTTON;
    }
    IAction dropDownAction = new Action("Dropdown", buttonStyle) {
        @Override
        public void run() {
            getSelected().run();
        }
    };
    dropDownAction.setMenuCreator(this);
    return dropDownAction;
}

From source file:cideplus.ui.astview.ASTView.java

License:Open Source License

private void makeActions() {
    fRefreshAction = new Action() {
        @Override/*  w ww. j a v a  2s . c om*/
        public void run() {
            performRefresh();
        }
    };
    fRefreshAction.setText("&Refresh AST"); //$NON-NLS-1$
    fRefreshAction.setToolTipText("Refresh AST"); //$NON-NLS-1$
    fRefreshAction.setEnabled(false);
    ASTViewImages.setImageDescriptors(fRefreshAction, ASTViewImages.REFRESH);

    fClearAction = new Action() {
        @Override
        public void run() {
            performClear();
        }
    };
    fClearAction.setText("&Clear AST"); //$NON-NLS-1$
    fClearAction.setToolTipText("Clear AST and release memory"); //$NON-NLS-1$
    fClearAction.setEnabled(false);
    ASTViewImages.setImageDescriptors(fClearAction, ASTViewImages.CLEAR);

    fASTInputKindActions = new ASTInputKindAction[] {
            new ASTInputKindAction("Use ASTParser.&createAST", ASTInputKindAction.USE_PARSER), //$NON-NLS-1$
            new ASTInputKindAction("Use ASTParser with &focal position", ASTInputKindAction.USE_FOCAL), //$NON-NLS-1$
            new ASTInputKindAction("Use ICompilationUnit.&reconcile", ASTInputKindAction.USE_RECONCILE), //$NON-NLS-1$
            new ASTInputKindAction("Use SharedASTProvider.&getAST", ASTInputKindAction.USE_CACHE) //$NON-NLS-1$
    };

    fCreateBindingsAction = new Action("&Create Bindings", IAction.AS_CHECK_BOX) { //$NON-NLS-1$
        @Override
        public void run() {
            performCreateBindings();
        }
    };
    fCreateBindingsAction.setChecked(fCreateBindings);
    fCreateBindingsAction.setToolTipText("Create Bindings"); //$NON-NLS-1$
    fCreateBindingsAction.setEnabled(true);

    fStatementsRecoveryAction = new Action("&Statements Recovery", IAction.AS_CHECK_BOX) { //$NON-NLS-1$
        @Override
        public void run() {
            performStatementsRecovery();
        }
    };
    fStatementsRecoveryAction.setChecked(fStatementsRecovery);
    fStatementsRecoveryAction.setEnabled(true);

    fBindingsRecoveryAction = new Action("&Bindings Recovery", IAction.AS_CHECK_BOX) { //$NON-NLS-1$
        @Override
        public void run() {
            performBindingsRecovery();
        }
    };
    fBindingsRecoveryAction.setChecked(fBindingsRecovery);
    fBindingsRecoveryAction.setEnabled(true);

    fIgnoreMethodBodiesAction = new Action("&Ignore Method Bodies", IAction.AS_CHECK_BOX) { //$NON-NLS-1$
        @Override
        public void run() {
            performIgnoreMethodBodies();
        }
    };
    fIgnoreMethodBodiesAction.setChecked(fIgnoreMethodBodies);
    fIgnoreMethodBodiesAction.setEnabled(true);

    fFilterNonRelevantAction = new Action("&Hide Non-Relevant Attributes", IAction.AS_CHECK_BOX) { //$NON-NLS-1$
        @Override
        public void run() {
            performFilterNonRelevant();
        }
    };
    fFilterNonRelevantAction.setChecked(!fNonRelevantFilter.isShowNonRelevant());
    fFilterNonRelevantAction.setToolTipText("Hide non-relevant binding attributes"); //$NON-NLS-1$
    fFilterNonRelevantAction.setEnabled(true);

    fFindDeclaringNodeAction = new Action("Find &Declaring Node...", IAction.AS_PUSH_BUTTON) { //$NON-NLS-1$
        @Override
        public void run() {
            performFindDeclaringNode();
        }
    };
    fFindDeclaringNodeAction.setToolTipText("Find Declaring Node..."); //$NON-NLS-1$
    fFindDeclaringNodeAction.setEnabled(false);

    fParseBindingFromElementAction = new Action("&Parse Binding from &Element Handle...", //$NON-NLS-1$
            IAction.AS_PUSH_BUTTON) {
        @Override
        public void run() {
            performParseBindingFromElement();
        }
    };
    fParseBindingFromElementAction.setToolTipText("Parse Binding from Element Handle..."); //$NON-NLS-1$
    fParseBindingFromElementAction.setEnabled(true);

    fParseBindingFromKeyAction = new Action("Parse Binding from &Key...", IAction.AS_PUSH_BUTTON) { //$NON-NLS-1$
        @Override
        public void run() {
            performParseBindingFromKey();
        }
    };
    fParseBindingFromKeyAction.setToolTipText("Parse Binding from Key..."); //$NON-NLS-1$
    fParseBindingFromKeyAction.setEnabled(true);

    fFocusAction = new Action() {
        @Override
        public void run() {
            performSetFocus();
        }
    };
    fFocusAction.setText("&Show AST of active editor"); //$NON-NLS-1$
    fFocusAction.setToolTipText("Show AST of active editor"); //$NON-NLS-1$
    fFocusAction.setActionDefinitionId(IWorkbenchCommandConstants.FILE_REFRESH);
    ASTViewImages.setImageDescriptors(fFocusAction, ASTViewImages.SETFOCUS);

    fCollapseAction = new Action() {
        @Override
        public void run() {
            performCollapse();
        }
    };
    fCollapseAction.setText("C&ollapse"); //$NON-NLS-1$
    fCollapseAction.setToolTipText("Collapse Selected Node"); //$NON-NLS-1$
    fCollapseAction.setEnabled(false);
    ASTViewImages.setImageDescriptors(fCollapseAction, ASTViewImages.COLLAPSE);

    fExpandAction = new Action() {
        @Override
        public void run() {
            performExpand();
        }
    };
    fExpandAction.setText("E&xpand"); //$NON-NLS-1$
    fExpandAction.setToolTipText("Expand Selected Node"); //$NON-NLS-1$
    fExpandAction.setEnabled(false);
    ASTViewImages.setImageDescriptors(fExpandAction, ASTViewImages.EXPAND);

    fCopyAction = new TreeCopyAction(new Tree[] { fViewer.getTree(), fTray.getTree() });

    fDoubleClickAction = new Action() {
        @Override
        public void run() {
            performDoubleClick();
        }
    };

    fLinkWithEditor = new Action() {
        @Override
        public void run() {
            performLinkWithEditor();
        }
    };
    fLinkWithEditor.setChecked(fDoLinkWithEditor);
    fLinkWithEditor.setText("&Link with Editor"); //$NON-NLS-1$
    fLinkWithEditor.setToolTipText("Link With Editor"); //$NON-NLS-1$
    fLinkWithEditor.setActionDefinitionId(IWorkbenchCommandConstants.NAVIGATE_TOGGLE_LINK_WITH_EDITOR);
    ASTViewImages.setImageDescriptors(fLinkWithEditor, ASTViewImages.LINK_WITH_EDITOR);

    fASTVersionToggleActions = new ASTLevelToggle[] { new ASTLevelToggle("AST Level &2.0", JLS2), //$NON-NLS-1$
            new ASTLevelToggle("AST Level &3.0", JLS3) //$NON-NLS-1$
    };

    fAddToTrayAction = new Action() {
        @Override
        public void run() {
            performAddToTray();
        }
    };
    fAddToTrayAction.setText("&Add to Comparison Tray"); //$NON-NLS-1$
    fAddToTrayAction.setToolTipText("Add Selected Node to Comparison Tray"); //$NON-NLS-1$
    fAddToTrayAction.setEnabled(false);
    ASTViewImages.setImageDescriptors(fAddToTrayAction, ASTViewImages.ADD_TO_TRAY);

    fDeleteAction = new Action() {
        @Override
        public void run() {
            performDelete();
        }
    };
    fDeleteAction.setText("&Delete"); //$NON-NLS-1$
    fDeleteAction.setToolTipText("Delete Binding from Tray"); //$NON-NLS-1$
    fDeleteAction.setEnabled(false);
    fDeleteAction.setImageDescriptor(ASTViewPlugin.getDefault().getWorkbench().getSharedImages()
            .getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
    fDeleteAction.setId(ActionFactory.DELETE.getId());
    fDeleteAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_DELETE);

    refreshASTSettingsActions();
}

From source file:com.agynamix.platform.frontend.action.ClearClipboardTableAction.java

License:Open Source License

public ClearClipboardTableAction(ApplicationWindow w, boolean isNetworkRemove) {
    super(isNetworkRemove ? "Clear Table Everywhere" : "Clear Table Locally", IAction.AS_PUSH_BUTTON);
    this.window = w;
    this.isNetworkRemove = isNetworkRemove;
    if (isNetworkRemove) {
        setToolTipText("Clears all entries from the clipboard table AND all connected clients");
        setImageDescriptor(PlatformIcons.getDescriptor(PlatformIcons.NETWORK_CLEAR_CLIPBOARD));
    } else {// ww w .  ja  v  a2  s  . c  o  m
        setToolTipText("Clears all entries from the clipboard table");
        setImageDescriptor(PlatformIcons.getDescriptor(PlatformIcons.CLEAR_CLIPBOARD));
    }
}

From source file:com.agynamix.platform.frontend.action.CopyAction.java

License:Open Source License

public CopyAction(ApplicationWindow w) {
    super("Copy Selected Entry", IAction.AS_PUSH_BUTTON);
    this.window = w;
    setToolTipText("Copy the selected entry to the clipboard");
    setAccelerator(SWT.MOD1 + 'C');
    setImageDescriptor(PlatformIcons.getDescriptor(PlatformIcons.COPY));
}

From source file:com.agynamix.platform.frontend.action.CutAction.java

License:Open Source License

public CutAction(ApplicationWindow w) {
    super("Cut Selected Entry", IAction.AS_PUSH_BUTTON);
    this.window = w;
    setToolTipText("Copy the selected entry to clipboard and remove it from the list");
    setAccelerator(SWT.MOD1 + 'X');
    setImageDescriptor(PlatformIcons.getDescriptor(PlatformIcons.CUT));
}

From source file:com.agynamix.platform.frontend.action.InputTextAction.java

License:Open Source License

public InputTextAction(ApplicationWindow w) {
    super("Simple Text Editor", IAction.AS_PUSH_BUTTON);
    this.window = w;
    setToolTipText("Open the Simple Text Editor to directly input text");
    setAccelerator(SWT.MOD1 + 'N');
    setImageDescriptor(PlatformIcons.getDescriptor(PlatformIcons.INPUT_TEXT));
}