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

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

Introduction

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

Prototype

boolean isChecked();

Source Link

Document

Returns the checked status of this action.

Usage

From source file:ch.qos.logback.beagle.actions.ToggleTreeActionDelegate.java

License:Open Source License

@Override
public void run(IAction action) {
    this.action = action;
    if (beagleView != null) {
        Sash sash = getSash(beagleView);
        FormData formData = (FormData) sash.getLayoutData();
        if (action.isChecked()) {
            SashUtil.setXCoordinate(sash, formData, oldSashXCoordinate);
        } else {/*from ww w .j a va  2 s  . co  m*/
            oldSashXCoordinate = formData.left.offset;
            SashUtil.setXCoordinate(sash, formData, 0);
        }
        boolean checked = action.isChecked();
        sash.getParent().layout(); // WARNING: .layout() will also call the
                                   // above listener, but here we must preserve
                                   // the checked status
        action.setChecked(checked);
    }
}

From source file:com.aptana.ide.debug.internal.ui.actions.ShowConstantsActionDelegate.java

License:Open Source License

/**
 * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
 *///from  w  w  w .j a v a  2  s .com
public void run(IAction action) {
    IPreferenceStore store = getPreferenceStore();
    String key = fView.getSite().getId() + "." + getPreferenceKey(); //$NON-NLS-1$
    store.setValue(key, action.isChecked());
    DebugUiPlugin.getDefault().savePluginPreferences();
    getStructuredViewer().refresh();
}

From source file:com.aptana.ide.debug.internal.ui.actions.SuspendOnActionDelegate.java

License:Open Source License

/**
 * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
 *//*from  w w  w .  ja v  a 2 s  . c om*/
public void run(IAction action) {
    if (selectedTarget != null) {
        boolean checked = action.isChecked();
        selectedTarget.setAttribute(getActionOption(action), Boolean.toString(checked));
    }
}

From source file:com.aptana.ide.editors.actions.ShowErrors.java

License:Open Source License

/**
 * The action has been activated. The argument of the method represents the
 * 'real' action sitting in the workbench UI.
 * // www.  j a  va2s. c  om
 * @param action
 */
public void run(IAction action) {
    state = action.isChecked();
    IPreferenceStore preferenceStore = UnifiedEditorsPlugin.getDefault().getPreferenceStore();
    preferenceStore.setValue(IPreferenceConstants.SHOW_ERRORS, state);

    String[] keys = FileContextManager.getKeySet();
    for (int i = 0; i < keys.length; i++) {
        FileService fc = FileContextManager.get(keys[i]);
        if (fc != null) {
            fc.forceContentChangedEvent();
        }
    }
}

From source file:com.aptana.ide.editors.actions.ShowInfos.java

License:Open Source License

/**
 * The action has been activated. The argument of the method represents the
 * 'real' action sitting in the workbench UI.
 * /*from  w ww  . j  a  v  a2  s .  c  o  m*/
 * @param action
 */
public void run(IAction action) {
    state = action.isChecked();
    IPreferenceStore preferenceStore = UnifiedEditorsPlugin.getDefault().getPreferenceStore();
    preferenceStore.setValue(IPreferenceConstants.SHOW_INFOS, state);
    String[] keys = FileContextManager.getKeySet();
    for (int i = 0; i < keys.length; i++) {
        FileService fc = FileContextManager.get(keys[i]);
        if (fc != null) {
            fc.forceContentChangedEvent();
        }
    }
}

From source file:com.aptana.ide.editors.actions.ShowWarnings.java

License:Open Source License

/**
 * The action has been activated. The argument of the method represents the 'real' action sitting in the workbench
 * UI./*from w  w  w.ja  va2  s  . com*/
 * 
 * @param action
 */
public void run(IAction action) {
    state = action.isChecked();
    IPreferenceStore preferenceStore = UnifiedEditorsPlugin.getDefault().getPreferenceStore();
    preferenceStore.setValue(IPreferenceConstants.SHOW_WARNINGS, state);
    String[] keys = FileContextManager.getKeySet();
    for (int i = 0; i < keys.length; i++) {
        FileService fc = FileContextManager.get(keys[i]);
        if (fc != null) {
            fc.forceContentChangedEvent();
        }
    }
}

From source file:com.aptana.ide.editors.actions.WordWrap.java

License:Open Source License

/**
 * The action has been activated. The argument of the method represents the 'real' action sitting in the workbench
 * UI.//  ww w  .  j  a va2  s .com
 * 
 * @param action
 */
public void run(IAction action) {
    state = action.isChecked();
    setWordWrap(state);
}

From source file:com.aptana.js.debug.ui.internal.actions.ShowConstantsActionDelegate.java

License:Open Source License

public void run(IAction action) {
    IEclipsePreferences preferences = getPreferences();
    String key = fView.getSite().getId() + "." + getPreferenceKey(); //$NON-NLS-1$
    preferences.putBoolean(key, action.isChecked());
    try {//ww w. j a va2 s.c  o  m
        preferences.flush();
    } catch (BackingStoreException e) {
        IdeLog.logError(JSDebugUIPlugin.getDefault(), e);
    }
    getStructuredViewer().refresh();
}

From source file:com.arc.cdt.debug.seecode.internal.ui.action.ShowAnimationWidgetsActionDelegate.java

License:Open Source License

@Override
public void run(IAction action) {

    IPreferenceStore store = getPreferenceStore();
    String key = getPreferenceKey();
    store.setValue(key, action.isChecked());
    apply(action.isChecked());//from  w ww  .j  av a2  s  . c o m
}

From source file:com.architexa.diagrams.relo.jdt.actions.Script2Action.java

License:Open Source License

/**
 * @see IActionDelegate#run(IAction)// w  w w. java 2  s .co m
 */
public void run(IAction action) {
    try {
        //dumpMethodBody((IMethod) selList.get(0));

        //System.err.println(
        //   "trying to execute action: "
        //      + action.getClass()
        //      + " -- "
        //      + action.getText());

        //ReloPlugin
        //   .getDefault()
        //   .getWorkbench()
        //   .getActiveWorkbenchWindow()
        //   .getActivePage()
        //   .openEditor(new ListEditorInput(selList), "com.architexa.diagrams.relo.editor");

        IMethod method = (IMethod) selList.get(0);
        IFile file = (IFile) ((IMember) method).getCompilationUnit().getResource();
        IWorkbenchPage page = getActivePage();
        //IEditorDescriptor editorDesc = IDE.getEditorDescriptor(file);
        JavaEditorlet jelet = (JavaEditorlet) page.openEditor(new FileEditorInput(file),
                "com.architexa.diagrams.relo.jdt.JavaEditorlet", true);

        /*
        String editorId = "com.architexa.diagrams.relo.jdt.JavaEditorlet";
        FileEditorInput input = new FileEditorInput(file);
        JavaEditorlet jelet = null;
                
        IEditorPart editor = null;
                
        // Remember the old visible editor
        IEditorPart oldVisibleEditor = page.getActiveEditor();
                
        // Otherwise, create a new one. This may cause the new editor to
        // become the visible (i.e top) editor.
        IEditorReference ref = null;
        IEditorRegistry reg = WorkbenchPlugin.getDefault().getEditorRegistry();
        EditorDescriptor desc = (EditorDescriptor) reg.findEditor(editorId);
        if (desc == null) {
         throw new PartInitException(WorkbenchMessages.format("EditorManager.unknownEditorIDMessage", new Object[] { editorId })); //$NON-NLS-1$
        }
                
        //ref = getEditorManager().openEditor(editorID, input, true);
        //ref = openEditorFromDescriptor(new Editor(), desc, input);
        //if (ref != null) {
        //   editor = ref.getEditor(true);
        //   addPart(ref);
        //}
                
        // Open the instance.
        editor = createPart(desc);
        EditorSite site = new EditorSite(ref, editor, (WorkbenchPage) page, desc);
        if (desc != null)
         site.setActionBars(createEditorActionBars(desc));
        else
         site.setActionBars(createEmptyEditorActionBars());
                
        part.init(site, input);
                
        createEditorTab(ref, desc, input, setVisible);
                
        /*
        //firePartOpened(editor);
        setEditorAreaVisible(true);
        activate(editor);
        window.firePerspectiveChanged(
            this,
            getPerspective(),
            ref,
            CHANGE_EDITOR_OPEN);
        window.firePerspectiveChanged(
         this,
         getPerspective(),
         CHANGE_EDITOR_OPEN);
        */

        //jelet = (JavaEditorlet) editor;
        //*/

        IAction toggleAction = jelet.getEditorSite().getActionBars()
                .getGlobalActionHandler(ITextEditorActionDefinitionIds.TOGGLE_SHOW_SELECTED_ELEMENT_ONLY);
        if (toggleAction != null && toggleAction.isEnabled() && toggleAction.isChecked()) {
            if (toggleAction instanceof TextEditorAction) {
                // Reset the action 
                ((TextEditorAction) toggleAction).setEditor(null);
                // Restore the action 
                ((TextEditorAction) toggleAction).setEditor(jelet);
            } else {
                // Uncheck 
                toggleAction.run();
                // Check
                toggleAction.run();
            }
        }

        // launched editor!!
        //ISourceRange srcRange = ParseUtilities.getBodyRange(method);
        //jelet.setShowRange(srcRange);

        //ConsoleView.setVariable("lm", jelet);

    } catch (Exception e) {
        e.printStackTrace();
    }
    /*
    Shell shell = new Shell();
    MessageDialog.openInformation(
       shell,
       "JBrowse Plug-in",
       "New Action was executed.");
    */
}