org.eclipse.ui.IDecoratorManager Java Examples

The following examples show how to use org.eclipse.ui.IDecoratorManager. 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: DecoratorUtils.java    From xds-ide with Eclipse Public License 1.0 6 votes vote down vote up
public static void refreshXdsDecorators(IProject project, String decoratorId){
    IDecoratorManager decoratorManager = WorkbenchUtils.getWorkbench().getDecoratorManager();
    if (decoratorManager != null && decoratorManager.getEnabled(decoratorId)) {
        final IXdsDecorator decorator = (IXdsDecorator)decoratorManager.getBaseLabelProvider(decoratorId);
        if (decorator != null && project.exists()) {
        	try {
        		project.accept(new IResourceVisitor() {
        			@Override
        			public boolean visit(IResource resource) throws CoreException {
        				decorator.refresh(new IResource[]{resource});
        				return true;
        			}
        		});
        	} catch (CoreException e) {
        		LogHelper.logError(e);
        	}
        }
    }
}
 
Example #2
Source File: ApplicationWorkbenchAdvisor.java    From gama with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void initialize(final IWorkbenchConfigurer configurer) {

	ResourcesPlugin.getPlugin().getStateLocation();
	try {
		super.initialize(configurer);
		IDE.registerAdapters();
		configurer.setSaveAndRestore(true);

		final IDecoratorManager dm = configurer.getWorkbench().getDecoratorManager();
		dm.setEnabled("org.eclipse.pde.ui.binaryProjectDecorator", false);
		dm.setEnabled("org.eclipse.team.svn.ui.decorator.SVNLightweightDecorator", false);
		dm.setEnabled("msi.gama.application.decorator", true);
		dm.setEnabled("org.eclipse.ui.LinkedResourceDecorator", false);
		dm.setEnabled("org.eclipse.ui.VirtualResourceDecorator", false);
		dm.setEnabled("org.eclipse.xtext.builder.nature.overlay", false);
		if ( Display.getCurrent() != null ) {
			Display.getCurrent().getThread().setUncaughtExceptionHandler(GamaExecutorService.EXCEPTION_HANDLER);
		}
	} catch (final CoreException e) {
		// e.printStackTrace();
	}
	PluginActionBuilder.setAllowIdeLogging(false);
}
 
Example #3
Source File: GamaNavigator.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void createPartControl(final Composite compo) {
	this.parent = GamaToolbarFactory.createToolbars(this, compo);

	super.createPartControl(parent);
	restoreState();
	final IToolBarManager tb = getViewSite().getActionBars().getToolBarManager();
	for (final IContributionItem item : tb.getItems()) {
		if (item instanceof ActionContributionItem) {
			final ActionContributionItem aci = (ActionContributionItem) item;
			final IAction action = aci.getAction();
			if (action instanceof LinkEditorAction) {
				link = action;
				tb.remove(aci);
			} else if (action instanceof org.eclipse.ui.internal.navigator.actions.CollapseAllAction) {
				tb.remove(aci);
			}

		}
	}
	linkItem.setSelection(link.isChecked());
	tb.update(true);
	tb.insertBefore("toolbar.toggle", byDate.toCheckAction());
	tb.insertBefore("toolbar.toggle", expandAll.toAction());
	tb.insertBefore(expandAll.getId(), collapseAll.toAction());

	try {
		final IDecoratorManager mgr = PlatformUI.getWorkbench().getDecoratorManager();
		mgr.setEnabled("msi.gama.application.date.decorator", false);
	} catch (final CoreException e) {
		e.printStackTrace();
	}
	properties =
			new PropertyDialogAction(new SameShellProvider(getSite().getShell()), getSite().getSelectionProvider());
	findControl.initialize();

}
 
Example #4
Source File: MendeleyClient.java    From slr-toolkit with Eclipse Public License 1.0 5 votes vote down vote up
/**
   * This methods removes tokens and expiration date from class and preference store
   * in order to logout the user from mendeley
   * 
   */
  public void logout() {
  	access_token = "";
  	refresh_token = "";
  	expires_at = null;
 
  	store.setValue(PreferenceConstants.P_TOKEN, access_token);
store.setValue(PreferenceConstants.P_REFRESH_TOKEN, refresh_token);
store.setValue(PreferenceConstants.P_EXPIRE_DATE, 0L);
store.setValue(PreferenceConstants.P_MENDELEY, "mendeley_off");
try {
	if(store instanceof ScopedPreferenceStore) {
		((ScopedPreferenceStore) store).save();
	}
} catch (IOException e) {
	e.printStackTrace();
}

// Remove links between Mendeley Folders and Files after logout
wm = WorkspaceManager.getInstance();
for(WorkspaceBibTexEntry entry : wm.getWorkspaceEntries()) {
	entry.setMendeleyFolder(null);
}

// Remove text decorations from Project Navigation after logout
IDecoratorManager decoratorManager = PlatformUI.getWorkbench().getDecoratorManager();
decoratorManager.update("de.tudresden.slr.model.mendeley.decorators.MendeleyOverlayDecorator");
  }
 
Example #5
Source File: MSyncWizard.java    From slr-toolkit with Eclipse Public License 1.0 5 votes vote down vote up
@Override
  public boolean performCancel() {
// if wizard is cancelled connection between the selected Bib-file and its Folder will be lost
  	if(zero.getResourceSelected()!=null) {
	WorkspaceBibTexEntry entry = wm.getWorkspaceBibTexEntryByUri(zero.getResourceSelected().getUri());
	entry.setMendeleyFolder(null);
	IDecoratorManager decoratorManager = PlatformUI.getWorkbench().getDecoratorManager();
	decoratorManager.update("de.tudresden.slr.model.mendeley.decorators.MendeleyOverlayDecorator");
}
  	return super.performCancel();
  }
 
Example #6
Source File: JavaOutlineInformationControl.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected TreeViewer createTreeViewer(Composite parent, int style) {
	Tree tree= new Tree(parent, SWT.SINGLE | (style & ~SWT.MULTI));
	GridData gd= new GridData(GridData.FILL_BOTH);
	gd.heightHint= tree.getItemHeight() * 12;
	tree.setLayoutData(gd);

	final TreeViewer treeViewer= new OutlineTreeViewer(tree);

	// Hard-coded filters
	treeViewer.addFilter(new NamePatternFilter());
	treeViewer.addFilter(new MemberFilter());

	fInnerLabelProvider= new OutlineLabelProvider();
	fInnerLabelProvider.addLabelDecorator(new ProblemsLabelDecorator(null));
	IDecoratorManager decoratorMgr= PlatformUI.getWorkbench().getDecoratorManager();
	if (decoratorMgr.getEnabled("org.eclipse.jdt.ui.override.decorator")) //$NON-NLS-1$
		fInnerLabelProvider.addLabelDecorator(new OverrideIndicatorLabelDecorator(null));

	treeViewer.setLabelProvider(new ColoringLabelProvider(fInnerLabelProvider));

	fLexicalSortingAction= new LexicalSortingAction(treeViewer);
	fSortByDefiningTypeAction= new SortByDefiningTypeAction(treeViewer);
	fShowOnlyMainTypeAction= new ShowOnlyMainTypeAction(treeViewer);
	fCategoryFilterActionGroup= new CategoryFilterActionGroup(treeViewer, getId(), getInputForCategories());

	fOutlineContentProvider= new OutlineContentProvider(false);
	treeViewer.setContentProvider(fOutlineContentProvider);
	fOutlineSorter= new OutlineSorter();
	treeViewer.setComparator(fOutlineSorter);
	treeViewer.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS);


	treeViewer.getTree().addKeyListener(getKeyAdapter());

	return treeViewer;
}
 
Example #7
Source File: DerbyIsRunningDecorator.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
public static void performUpdateDecor(IProject proj) {
IDecoratorManager dm = DerbyPlugin.getDefault().getWorkbench().getDecoratorManager();
DerbyIsRunningDecorator decorator = (DerbyIsRunningDecorator)dm.getBaseLabelProvider(CommonNames.RUNDECORATOR);
decorator.startUpdateDecor(proj);
  }
 
Example #8
Source File: DerbyIsRunningDecorator.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
public static void performUpdateDecor(IProject proj) {
IDecoratorManager dm = DerbyPlugin.getDefault().getWorkbench().getDecoratorManager();
DerbyIsRunningDecorator decorator = (DerbyIsRunningDecorator)dm.getBaseLabelProvider(CommonNames.RUNDECORATOR);
decorator.startUpdateDecor(proj);
  }