org.eclipse.ui.IActionBars Java Examples

The following examples show how to use org.eclipse.ui.IActionBars. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EipEditor.java    From eip-designer with Apache License 2.0 6 votes vote down vote up
/**
   * This accesses a cached version of the property sheet.
   * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
   * @generated
   */
public IPropertySheetPage getPropertySheetPage() {
     PropertySheetPage propertySheetPage =
        new ExtendedPropertySheetPage(editingDomain) {
           @Override
           public void setSelectionToViewer(List<?> selection) {
              EipEditor.this.setSelectionToViewer(selection);
              EipEditor.this.setFocus();
           }

           @Override
           public void setActionBars(IActionBars actionBars) {
              super.setActionBars(actionBars);
              getActionBarContributor().shareGlobalActions(this, actionBars);
           }
        };
     propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory));
     propertySheetPages.add(propertySheetPage);

     return propertySheetPage;
  }
 
Example #2
Source File: ERDiagramOutlinePage.java    From erflute with Apache License 2.0 6 votes vote down vote up
private void resetAction(ActionRegistry registry) {
    if (getSite() == null) {
        return;
    }
    final IActionBars bars = getSite().getActionBars();

    String id = ActionFactory.UNDO.getId();
    bars.setGlobalActionHandler(id, registry.getAction(id));

    id = ActionFactory.REDO.getId();
    bars.setGlobalActionHandler(id, registry.getAction(id));

    id = ActionFactory.DELETE.getId();
    bars.setGlobalActionHandler(id, registry.getAction(id));

    bars.updateActionBars();
}
 
Example #3
Source File: GlobalizeEditor.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * This accesses a cached version of the property sheet.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public IPropertySheetPage getPropertySheetPage ()
{
    PropertySheetPage propertySheetPage = new ExtendedPropertySheetPage ( editingDomain ) {
        @Override
        public void setSelectionToViewer ( List<?> selection )
        {
            GlobalizeEditor.this.setSelectionToViewer ( selection );
            GlobalizeEditor.this.setFocus ();
        }

        @Override
        public void setActionBars ( IActionBars actionBars )
        {
            super.setActionBars ( actionBars );
            getActionBarContributor ().shareGlobalActions ( this, actionBars );
        }
    };
    propertySheetPage.setPropertySourceProvider ( new AdapterFactoryContentProvider ( adapterFactory ) );
    propertySheetPages.add ( propertySheetPage );

    return propertySheetPage;
}
 
Example #4
Source File: GenconfEditor.java    From M2Doc with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * This accesses a cached version of the property sheet.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated
 */
public IPropertySheetPage getPropertySheetPage() {
    PropertySheetPage propertySheetPage = new ExtendedPropertySheetPage(editingDomain) {
        @Override
        public void setSelectionToViewer(List<?> selection) {
            GenconfEditor.this.setSelectionToViewer(selection);
            GenconfEditor.this.setFocus();
        }

        @Override
        public void setActionBars(IActionBars actionBars) {
            super.setActionBars(actionBars);
            getActionBarContributor().shareGlobalActions(this, actionBars);
        }
    };
    propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory));
    propertySheetPages.add(propertySheetPage);

    return propertySheetPage;
}
 
Example #5
Source File: SecurityEditor.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * This accesses a cached version of the property sheet.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public IPropertySheetPage getPropertySheetPage ()
{
    PropertySheetPage propertySheetPage =
            new ExtendedPropertySheetPage ( editingDomain )
            {
                @Override
                public void setSelectionToViewer ( List<?> selection )
                {
                    SecurityEditor.this.setSelectionToViewer ( selection );
                    SecurityEditor.this.setFocus ();
                }

                @Override
                public void setActionBars ( IActionBars actionBars )
                {
                    super.setActionBars ( actionBars );
                    getActionBarContributor ().shareGlobalActions ( this, actionBars );
                }
            };
    propertySheetPage.setPropertySourceProvider ( new AdapterFactoryContentProvider ( adapterFactory ) );
    propertySheetPages.add ( propertySheetPage );

    return propertySheetPage;
}
 
Example #6
Source File: CallHierarchyViewPart.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void fillActionBars() {
      IActionBars actionBars = getActionBars();
actionBars.setGlobalActionHandler(ActionFactory.REFRESH.getId(), fRefreshSingleElementAction);
actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), fRemoveFromViewAction);

      IToolBarManager toolBar = actionBars.getToolBarManager();

      fActionGroups.fillActionBars(actionBars);

      toolBar.add(fRefreshViewAction);
      toolBar.add(fCancelSearchAction);
      for (int i = 0; i < fToggleCallModeActions.length; i++) {
          toolBar.add(fToggleCallModeActions[i]);
      }
      toolBar.add(fHistoryDropDownAction);
      toolBar.add(fPinViewAction);
  }
 
Example #7
Source File: EditViewPage.java    From uima-uimaj with Apache License 2.0 6 votes vote down vote up
@Override
public void setActionBars(IActionBars actionBars) {
  // pin action
  pinAction = new PinAction();

  pinAction.setText("Pin");
  pinAction.setImageDescriptor(CasEditorPlugin.getTaeImageDescriptor(Images.PIN));
  actionBars.getToolBarManager().add(pinAction);

  CreateFeatureStructrueValue createAction = new CreateFeatureStructrueValue();
  createAction.setImageDescriptor(CasEditorPlugin.getTaeImageDescriptor(Images.ADD));
  actionBars.getToolBarManager().add(createAction);

  // TODO: setActionBars is depreciated, but registration of change listener
  // does not work in init method
  getSite().getSelectionProvider().addSelectionChangedListener(createAction);

  // delete action
  DeleteFeatureStructureValue deleteAction = new DeleteFeatureStructureValue();
  actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), deleteAction);

  getSite().getSelectionProvider().addSelectionChangedListener(deleteAction);

  actionBars.getToolBarManager().add(
          ActionFactory.DELETE.create(getSite().getWorkbenchWindow()));
}
 
Example #8
Source File: OsgiEditor.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * This accesses a cached version of the property sheet.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public IPropertySheetPage getPropertySheetPage ()
{
    PropertySheetPage propertySheetPage = new ExtendedPropertySheetPage ( editingDomain, ExtendedPropertySheetPage.Decoration.MANUAL) {
        @Override
        public void setSelectionToViewer ( List<?> selection )
        {
            OsgiEditor.this.setSelectionToViewer ( selection );
            OsgiEditor.this.setFocus ();
        }

        @Override
        public void setActionBars ( IActionBars actionBars )
        {
            super.setActionBars ( actionBars );
            getActionBarContributor ().shareGlobalActions ( this, actionBars );
        }
    };
    propertySheetPage.setPropertySourceProvider ( new AdapterFactoryContentProvider ( adapterFactory ) );
    propertySheetPages.add ( propertySheetPage );

    return propertySheetPage;
}
 
Example #9
Source File: CustomOpenActionProvider.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void fillActionBars(IActionBars theActionBars) {
    if (!contribute) {
        return;
    }
    openFileAction.setContext(getContext());

    OpenAction customOpenAction = createCustomOpenAction();
    if (openFileAction.getOpenAction().isEnabled()) {
        theActionBars.setGlobalActionHandler(ICommonActionConstants.OPEN,
                customOpenAction);
    } else if (UIDArtifactFilters
            .isUIDArtifact(((IStructuredSelection) getContext().getSelection()).getFirstElement())) {
        theActionBars.setGlobalActionHandler(ICommonActionConstants.OPEN,
                customOpenAction);
    }
}
 
Example #10
Source File: SourceView.java    From lapse-plus with GNU General Public License v3.0 5 votes vote down vote up
private void contributeToActionBars() {
	
	IActionBars bars = getViewSite().getActionBars();
	fillLocalToolBar(bars.getToolBarManager());
	
	LapseMultiActionGroup group = 
		new LapseCheckboxActionGroup(
				new IAction[] {hideNonWebAction, hideNoSourceAction},
				new boolean[] {true		   , 	 true});
	group.addActions(bars.getMenuManager());
}
 
Example #11
Source File: AbstractViewerActionGroup.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void fillActionBars(IActionBars actionBars) {
	IToolBarManager tbm = actionBars.getToolBarManager();
	for (IAdaptable.Bound<IViewer> va : getContributions()) {
		if (va instanceof IAction) {
			tbm.add((IAction) va);
		} else if (va instanceof IContributionItem) {
			tbm.add((IContributionItem) va);
		}
	}
}
 
Example #12
Source File: CalcitePane.java    From mat-calcite-plugin with Apache License 2.0 5 votes vote down vote up
private void installUndoRedoSupport() {
	IUndoContext undoContext = ((IUndoManagerExtension) queryViewer.getUndoManager()).getUndoContext();

	UndoActionHandler undoAction = new UndoActionHandler(getSite(), undoContext);
	RedoActionHandler redoAction = new RedoActionHandler(getSite(), undoContext);

	undoAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_UNDO);
	redoAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_REDO);

	IActionBars actionBars = getEditor().getEditorSite().getActionBars();
	actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), undoAction);
	actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), redoAction);

	actionBars.updateActionBars();
}
 
Example #13
Source File: N4JSOpenActions.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void fillActionBars(final IActionBars actionBars) {
	if (inViewPart && canEnableOpenAction()) {
		openGroup.fillActionBars(actionBars);
		if (openAndExpandAction == null && openGroup.getOpenAction().isEnabled()) {
			actionBars.setGlobalActionHandler(ICommonActionConstants.OPEN, openGroup.getOpenAction());
		} else if (openAndExpandAction != null && openAndExpandAction.isEnabled()) {
			actionBars.setGlobalActionHandler(ICommonActionConstants.OPEN, openAndExpandAction);
		}
	}
}
 
Example #14
Source File: ViewEditor.java    From depan with Apache License 2.0 5 votes vote down vote up
/**
 * Take a screenshot of the given view. Ask the user a filename, and use
 * this filename to determine which type of file format has to be used.
 * PNG format is used as default.
 *
 * @param view the view to capture.
 */
public void takeScreenshot() {
  // make the screenshot first, so that the overlapping file selection window
  // does not Interfere with the process of taking the screenshot
  // (apparently, otherwise, it does)
  BufferedImage screenshot = renderer.takeScreenshot();

  // ask the user a filename where to save the screenshot
  FileDialog fd = new FileDialog( getSite().getShell(), SWT.SAVE);
  fd.setText("Save Screenshot:");
  String[] filterExt = { "*.png", "*.jpg", "*.gif", "*.bmp", "*.*" };
  fd.setFilterExtensions(filterExt);
  String selected = fd.open();

  IActionBars bars = getEditorSite().getActionBars();

  // user canceled operation. Print a message in the status line, and return.
  if (null == selected) {
    bars.getStatusLineManager().setErrorMessage(
        "To take a screenshot, you must specify a filename.");
    return;
  }

  // check if the file has an extension. otherwise, use .png as default
  // extension.
  if (selected.lastIndexOf('.') == -1) {
    selected = selected+".png";
  }

  try {
    // finally, write the image on a file.
    ImageIO.write(screenshot, selected.substring(
        selected.lastIndexOf('.')+1), new File(selected));
    bars.getStatusLineManager().setMessage("Image saved to "+selected);
  } catch (IOException e) {
    e.printStackTrace();
    bars.getStatusLineManager().setErrorMessage(
        "Error while saving screenshot");
  }
}
 
Example #15
Source File: RefactorActionGroup.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
public void fillActionBars(IActionBars actionBars) {

		// renameAction.setTextActionHandler(textActionHandler);
		updateActionBars();

		actionBars.setGlobalActionHandler(ActionFactory.MOVE.getId(), moveAction);
		actionBars.setGlobalActionHandler(ActionFactory.RENAME.getId(), renameAction);
	}
 
Example #16
Source File: DerivedSourceView.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
private void createActions() {
	IActionBars actionBars = getViewSite().getActionBars();
	IToolBarManager toolBarManager = actionBars.getToolBarManager();
	openEditorAction = new OpenEditorAction(this);
	openEditorAction.setEnabled(false);
	toolBarManager.add(openEditorAction);
	toolBarManager.add(new DerivedSourceDropDownAction(this));
}
 
Example #17
Source File: OpenActionProvider.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void fillActionBars(final IActionBars theActionBars) {
	if (!contribute) { return; }
	final IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();
	if (selection.size() == 1 && selection.getFirstElement() instanceof WrappedFile) {
		openFileAction.selectionChanged(selection);
		theActionBars.setGlobalActionHandler(ICommonActionConstants.OPEN, openFileAction);
	}

}
 
Example #18
Source File: ReferencesSearchGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void fillActionBars(IActionBars actionBars) {
	Assert.isNotNull(actionBars);
	super.fillActionBars(actionBars);
	fActionBars= actionBars;
	updateGlobalActionHandlers();
}
 
Example #19
Source File: TypeScriptContentOutlinePage.java    From typescript.java with MIT License 5 votes vote down vote up
/**
 * Register toolbar actions.
 * 
 * @param actionBars
 */
private void registerToolbarActions(IActionBars actionBars) {
	// Toolbar
	IToolBarManager toolBarManager = actionBars.getToolBarManager();
	toolBarManager.add(new CollapseAllAction(this.fOutlineViewer));

	// Menu
	IMenuManager viewMenuManager = actionBars.getMenuManager();
	viewMenuManager.add(new Separator("EndFilterGroup")); //$NON-NLS-1$
	viewMenuManager.add(new ToggleLinkingAction());

}
 
Example #20
Source File: FindOccurrencesInFileAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private static void showMessage(Shell shell, IActionBars actionBars, String msg) {
	if (actionBars != null) {
		IStatusLineManager statusLine= actionBars.getStatusLineManager();
		if (statusLine != null)
			statusLine.setMessage(msg);
	}
	shell.getDisplay().beep();
}
 
Example #21
Source File: CounterView.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void createPartControl(Composite parent) {
    super.createPartControl(parent);

    // Add a tool bar button to display counters data cumulatively
    IActionBars bars = getViewSite().getActionBars();
    bars.getToolBarManager().appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getCumulativeAction());
}
 
Example #22
Source File: FeatureStructureBrowserViewPage.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
/**
 * Sets global action handlers for: delete select all.
 *
 * @param actionBars the new action bars
 */
@Override
public void setActionBars(IActionBars actionBars) {
  actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), mDeleteAction);

  getSite().getSelectionProvider().addSelectionChangedListener(mDeleteAction);

  actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), mSelectAllAction);

  super.setActionBars(actionBars);
}
 
Example #23
Source File: TypeScriptSearchActionGroup.java    From typescript.java with MIT License 5 votes vote down vote up
public void fillActionBars(IActionBars actionBar) {
		super.fillActionBars(actionBar);
		fReferencesGroup.fillActionBars(actionBar);
//		fDeclarationsGroup.fillActionBars(actionBar);
////		fImplementorsGroup.fillActionBars(actionBar);
//		fReadAccessGroup.fillActionBars(actionBar);
//		fWriteAccessGroup.fillActionBars(actionBar);
//		fOccurrencesGroup.fillActionBars(actionBar);
	}
 
Example #24
Source File: MultiPageEditorContributor.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
@Override
public void setActiveEditor(IEditorPart part) {
  if (activeEditorPart == part)
    return;

  if (null == part)
    return;
  activeEditorPart = part;

  IActionBars actionBars = getActionBars();
  if (actionBars != null) {

    MultiPageEditorPart editor = (MultiPageEditorPart) part;

    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();
  }
}
 
Example #25
Source File: ProjectExplorerActionProvider.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void fillActionBars(IActionBars actionBars) {
	IMenuManager viewMenu = actionBars.getMenuManager();
	ICommonActionExtensionSite site = getActionSite();
	IContributionItem contributionItem = viewMenu.find(ShowResourcesContribution.ID);
	if (contributionItem != null) {
		viewMenu.remove(contributionItem);
	}
	if (ProjectUtils.isWorkspaceContainsXdsProjects()) {
		viewMenu.add(new ShowResourcesContribution(site.getStructuredViewer(), site.getExtensionStateModel()));
	}
}
 
Example #26
Source File: JavaSearchResultPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void fillToolbar(IToolBarManager tbm) {
	super.fillToolbar(tbm);

	IActionBars actionBars = getSite().getActionBars();
	if (actionBars != null) {
		actionBars.setGlobalActionHandler(CopyQualifiedNameAction.ACTION_HANDLER_ID, getCopyQualifiedNameAction());
	}

	if (getLayout() != FLAG_LAYOUT_FLAT)
		addGroupActions(tbm);
}
 
Example #27
Source File: CompositeActionGroup.java    From typescript.java with MIT License 5 votes vote down vote up
public void fillActionBars(IActionBars actionBars) {
	super.fillActionBars(actionBars);
	if (fGroups == null)
		return;
	for (int i= 0; i < fGroups.length; i++) {
		fGroups[i].fillActionBars(actionBars);
	}
}
 
Example #28
Source File: ConsoleRestartLaunchPageParticipant.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void init(IPageBookViewPage page, IConsole console) {
    try {
        if (!(console instanceof ProcessConsole)) {
            return;
        }
        ProcessConsole processConsole = (ProcessConsole) console;
        IProcess process = processConsole.getProcess();
        if (process == null) {
            return;
        }
        String attribute = process.getAttribute(IMiscConstants.PYDEV_ADD_RELAUNCH_IPROCESS_ATTR);
        if (!IMiscConstants.PYDEV_ADD_RELAUNCH_IPROCESS_ATTR_TRUE.equals(attribute)) {
            //Only provide relaunch if specified
            return;
        }
        this.fConsole = processConsole;
        DebugPlugin.getDefault().addDebugEventListener(this);

        IActionBars bars = page.getSite().getActionBars();

        IToolBarManager toolbarManager = bars.getToolBarManager();

        restartLaunchAction = new RestartLaunchAction(page, processConsole);
        terminateAllLaunchesAction = new TerminateAllLaunchesAction();

        toolbarManager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, restartLaunchAction);
        toolbarManager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, terminateAllLaunchesAction);

        bars.updateActionBars();
    } catch (Exception e) {
        Log.log(e);
    }

}
 
Example #29
Source File: OpenActionProvider.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
public void fillActionBars(IActionBars theActionBars) {
	if (!contribute) {
		return;
	}
	IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();
	if (selection.size() == 1 && selection.getFirstElement() instanceof IFile) {
		openFileAction.selectionChanged(selection);
		theActionBars.setGlobalActionHandler(ICommonActionConstants.OPEN, openFileAction);
	}

}
 
Example #30
Source File: PackageExplorerActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void fillActionBars(IActionBars actionBars) {
	super.fillActionBars(actionBars);
	setGlobalActionHandlers(actionBars);
	fillToolBar(actionBars.getToolBarManager());
	fillViewMenu(actionBars.getMenuManager());
}