List of usage examples for org.eclipse.jface.viewers DecoratingStyledCellLabelProvider DecoratingStyledCellLabelProvider
public DecoratingStyledCellLabelProvider(IStyledLabelProvider labelProvider, ILabelDecorator decorator,
IDecorationContext decorationContext)
From source file:org.eclipse.team.internal.ui.mapping.CommonViewerAdvisor.java
License:Open Source License
/** * Create the advisor using the given configuration * @param parent the parent/*from ww w. j a v a 2 s .co m*/ * @param configuration the configuration */ public CommonViewerAdvisor(Composite parent, ISynchronizePageConfiguration configuration) { super(configuration); final CommonViewer viewer = CommonViewerAdvisor.createViewer(parent, configuration, this); TeamUI.getTeamContentProviderManager().addPropertyChangeListener(this); configuration.addPropertyChangeListener(this); GridData data = new GridData(GridData.FILL_BOTH); viewer.getControl().setLayoutData(data); viewer.getNavigatorContentService().addListener(this); initializeViewer(viewer); IBaseLabelProvider provider = viewer.getLabelProvider(); if (provider instanceof DecoratingLabelProvider) { DecoratingLabelProvider dlp = (DecoratingLabelProvider) provider; ILabelDecorator decorator = ((SynchronizePageConfiguration) configuration).getLabelDecorator(); if (decorator != null) { ILabelProvider lp = dlp.getLabelProvider(); dlp = new DecoratingLabelProvider(new DecoratingLabelProvider(lp, decorator), PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator()); viewer.setLabelProvider(dlp); } DecorationContext decorationContext = new DecorationContext(); decorationContext.putProperty(SynchronizationStateTester.PROP_TESTER, new SynchronizationStateTester() { public boolean isStateDecorationEnabled() { return false; } }); dlp.setDecorationContext(decorationContext); } else if (provider instanceof DecoratingStyledCellLabelProvider) { DecoratingStyledCellLabelProvider dsclp = (DecoratingStyledCellLabelProvider) provider; ILabelDecorator decorator = ((SynchronizePageConfiguration) configuration).getLabelDecorator(); if (decorator != null) { IStyledLabelProvider slp = dsclp.getStyledStringProvider(); dsclp = new DecoratingStyledCellLabelProvider( new MyDecoratingStyledCellLabelProvider(slp, decorator), PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator(), null); viewer.setLabelProvider(dsclp); } DecorationContext decorationContext = new DecorationContext(); decorationContext.putProperty(SynchronizationStateTester.PROP_TESTER, new SynchronizationStateTester() { public boolean isStateDecorationEnabled() { return false; } }); dsclp.setDecorationContext(decorationContext); } }
From source file:org.eclipse.ui.tests.performance.LabelProviderTest.java
License:Open Source License
private DecoratingStyledCellLabelProvider getDecoratingStyledCellLabelProvider(boolean useColor) { // create our own context to avoid using default context IDecorationContext context = new IDecorationContext() { public String[] getProperties() { return null; }/* ww w . j av a 2 s . com*/ public Object getProperty(String property) { return null; } }; return new DecoratingStyledCellLabelProvider(new TestCellLabelProvider(useColor), useColor ? getDecorator() : null, context); }
From source file:org.fusesource.ide.camel.editor.globalconfiguration.CamelGlobalConfigEditor.java
License:Open Source License
private void createTreeViewer() { treeViewer = new TreeViewer(parent, SWT.BORDER | SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL); treeViewer.setUseHashlookup(true);/*from w w w. j a v a2 s. c o m*/ treeViewer.setContentProvider(new GlobalConfigContentProvider(this)); final ILabelDecorator labelDecorator = PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator(); final IBaseLabelProvider labelProvider = new DecoratingStyledCellLabelProvider( new GlobalConfigLabelProvider(this), labelDecorator, null); treeViewer.setLabelProvider(labelProvider); treeViewer.getControl().setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 1, 10)); treeViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { Object selObj = Selections.getFirstSelection(event.getSelection()); if (selObj != null) { btnModify.setEnabled(supportsEdit(selObj)); btnDelete.setEnabled(supportsDelete(selObj)); } else { btnModify.setEnabled(false); btnDelete.setEnabled(false); } } }); treeViewer.addFilter(new ViewerFilter() { @Override public boolean select(Viewer viewer, Object parentElement, Object element) { if (element instanceof String) { return !getModel().get(element).isEmpty(); } return true; } }); getSite().setSelectionProvider(treeViewer); }
From source file:org.fusesource.ide.jvmmonitor.internal.ui.views.JvmTreeViewer.java
License:Open Source License
/** * The constructor./*from w ww.j a va 2s .c om*/ * * @param parent * the parent composite * @param style * the style * @param actionBars * The action bars */ public JvmTreeViewer(Composite parent, int style, IActionBars actionBars) { super(parent, style); statusLineManager = actionBars.getStatusLineManager(); statusLineItem = new StatusLineContributionItem("StatusLineContributionItem"); //$NON-NLS-1$ statusLineManager.add(statusLineItem); setContentProvider(new JvmTreeContentProvider()); setLabelProvider(new DecoratingStyledCellLabelProvider(new JvmTreeLabelProvider(), PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator(), null)); createContextMenu(actionBars); addListeners(); new Job(Messages.initializeJvmExplorer) { @Override protected IStatus run(IProgressMonitor monitor) { // make sure not to instantiate JVM model in UI thread JvmModel.getInstance(); Display.getDefault().asyncExec(new Runnable() { @Override public void run() { setInput(new Object[0]); JvmModel.getInstance().addJvmModelChangeListener(JvmTreeViewer.this); } }); return Status.OK_STATUS; } }.schedule(); }
From source file:org.jboss.tools.jmx.jvmmonitor.internal.ui.views.JvmTreeViewer.java
License:Open Source License
/** * The constructor.//from w w w . j ava 2 s.co m * * @param parent * the parent composite * @param style * the style * @param actionBars * The action bars */ public JvmTreeViewer(Composite parent, int style, IActionBars actionBars) { super(parent, style); statusLineManager = actionBars.getStatusLineManager(); statusLineItem = new StatusLineContributionItem("StatusLineContributionItem"); //$NON-NLS-1$ statusLineManager.add(statusLineItem); setContentProvider(new JvmTreeContentProvider()); setLabelProvider(new DecoratingStyledCellLabelProvider(new JvmTreeLabelProvider(), PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator(), null)); createContextMenu(actionBars); addListeners(); new Job(Messages.initializeJvmExplorer) { @Override protected IStatus run(IProgressMonitor monitor) { // make sure not to instantiate JVM model in UI thread JvmModel.getInstance(); Display.getDefault().asyncExec(new Runnable() { @Override public void run() { setInput(new Object[0]); JvmModel.getInstance().addJvmModelChangeListener(JvmTreeViewer.this); TreeItem topItem = getTree().getTopItem(); if (topItem != null) { topItem.setExpanded(true); refresh(); } } }); return Status.OK_STATUS; } }.schedule(); }
From source file:org.jboss.tools.openshift.express.internal.ui.server.CommitDialog.java
License:Open Source License
private static CellLabelProvider createStatusLabelProvider() { CommitStatusLabelProvider baseProvider = new CommitStatusLabelProvider(); ProblemLabelDecorator decorator = new ProblemLabelDecorator(null); return new DecoratingStyledCellLabelProvider(baseProvider, decorator, null) { @Override//from w w w .j a va 2 s . c om public String getToolTipText(Object element) { return ((CommitItem) element).status.getText(); } }; }
From source file:org.opentravel.schemas.stl2developer.NavigatorMenus.java
License:Apache License
public NavigatorMenus(final Composite parent, final IWorkbenchPartSite site) { super(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); mainWindow = OtmRegistry.getMainWindow(); final MenuManager componentMenu = new MenuManager("Object", "Component_Menu_ID"); final MenuManager facetMenu = new MenuManager("Object", "Facet_Menu_ID"); final MenuManager propertyMenu = new MenuManager("Object", "Property_Menu_ID"); final MenuManager navigationMenu = new MenuManager("Object", "Navication_Menu_ID"); final MenuManager whereUsedMenu = new MenuManager("Object", "WhereUsed_ID"); final MenuManager enumObjectMenu = new MenuManager("Object", "Enum_Object_ID"); final MenuManager operationObjectMenu = new MenuManager("Object", "Operation_Object_ID"); final MenuManager roleObjectMenu = new MenuManager("Object", "Role_ID"); final MenuManager basicObjectMenu = new MenuManager("Object", "Basic_Object_ID"); final MenuManager basicWithCopyDeleteMoveMenu = new MenuManager("Object", "Basic_With_CopyDeleteMove_ID"); final MenuManager xpFacetObjectMenu = new MenuManager("Object", "ExtPointFacet_Object_ID"); final MenuManager simpleObjectMenu = new MenuManager("Object", "Simple_Object_ID"); final MenuManager serviceObjectMenu = new MenuManager("Object", "Service_Object_ID"); final MenuManager libraryChainMenu = new MenuManager("LibraryChain", "LibraryChain_ID"); final MenuManager libraryMenu = new MenuManager("Library", "Library_ID"); final MenuManager projectMenu = new MenuManager("Project", "Project_ID"); final MenuManager manageInMenu = new MenuManager("Manage in...", "Project_ID"); // final MenuManager modelMenu = new MenuManager("Model", "Model_ID"); final MenuManager copyMenu = new DisableIfEmptyMenu(Messages.getString("action.menu.navigation.copy"), "Copy_ID", Messages.getString("action.menu.navigation.copy.tooltip")); final MenuManager moveMenu = new DisableIfEmptyMenu(Messages.getString("action.menu.navigation.move"), "Move_ID", Messages.getString("action.menu.navigation.move.tooltip")); final Action newLibraryAction = new NewLibraryAction(mainWindow, new ExternalizedStringProperties("action.new")); final Action openLibraryAction = new OpenLibraryAction(); final Action commitLibraryAction = new CommitLibraryAction(); final Action finalizeLibraryAction = new FinalizeLibraryAction(); final Action lockLibraryAction = new LockLibraryAction(); final Action unlockLibraryAction = new UnlockLibraryAction(); // final IContributionItem openDirectoryAction = // RCPUtils.createCommandContributionItem(site, // OpenDirectoryHandler.COMMAND_ID, null, null, null); // Project Menu Items final IContributionItem closeProjectAction = RCPUtils.createCommandContributionItem(site, CloseProjectHandler.COMMAND_ID, null, null, null); final IContributionItem openProjectAction = RCPUtils.createCommandContributionItem(site, OpenProjectHandler.COMMAND_ID, null, null, null); final Action newProjectAction = new NewProjectAction(); final IContributionItem compileAction = RCPUtils.createCommandContributionItem(site, CompileHandler.COMMAND_ID, null, null, null); final IContributionItem saveAllLibrariesAction = RCPUtils.createCommandContributionItem(site, SaveLibrariesHandler.COMMAND_ID, null, null, SaveLibrariesHandler.getIcon()); final IContributionItem saveSelectedLibrariesAction = RCPUtils.createCommandContributionItem(site, SaveLibraryHandler.COMMAND_ID, null, null, SaveLibraryHandler.getIcon()); final IContributionItem closeLibraries = RCPUtils.createCommandContributionItem(site, CloseLibrariesHandler.COMMAND_ID, null, null, null); // final Action saveSelectedLibraryAsAction = new SaveSelectedLibraryAsAction(mainWindow, // new ExternalizedStringProperties("action.saveSelectedAs")); // final IContributionItem removeLibrariesAction = new ActionContributionItem( // ApplicationActionBarAdvisor.getCloseLibrary()); // final IContributionItem removeAllLibrariesAction = new ActionContributionItem( // ApplicationActionBarAdvisor.getCloseAllLibraryInProjectes()); // final Action saveModelAction = new SaveModelAction(mainWindow, new ExternalizedStringProperties( // "action.saveModel")); final Action cloneObjectAction = new CloneSelectedTreeNodesAction(mainWindow, new ExternalizedStringProperties("action.cloneObject")); // final Action setContextAction = new ChangeFacetContextAction(mainWindow); final Action changeObjectAction = new ChangeAction(mainWindow); final Action addCrudqOperationsAction = new AddCRUDQOperationsAction(mainWindow, new ExternalizedStringProperties("action.addCRUDQOperations")); // This is the go-to approach - let the actions have default properties final Action addAliasAction = new AddAliasAction(mainWindow); final Action addCustomFacetAction = new AddCustomFacetAction(); final Action addEnumValueAction = new AddEnumValueAction(mainWindow); final Action addOperationAction = new AddOperationAction(); final IContributionItem newComplexAction = RCPUtils.createCommandContributionItem(site, NewComponentHandler.COMMAND_ID, Messages.getString("action.newComplex.text"), null, null); final IContributionItem addPropertiesAction = RCPUtils.createCommandContributionItem(site, AddNodeHandler.COMMAND_ID, Messages.getString("action.addProperty.text"), null, AddNodeHandler.getIcon());//from ww w.j a v a 2 s. com final Action addQueryFacetAction = new AddQueryFacetAction(mainWindow); final Action addRoleAction = new AddRoleAction(mainWindow); final IContributionItem deleteObjectAction = RCPUtils.createCommandContributionItem(site, DeleteNodesHandler.COMMAND_ID, null, null, null); final Action replaceAction = new AssignTypeAction(mainWindow); final IContributionItem validateAction = RCPUtils.createCommandContributionItem(site, ValidateHandler.COMMAND_ID, null, null, ValidateHandler.getIcon()); final MenuManager versionMenu = new MenuManager("Version...", "VersionMenuID"); setContentProvider(new LibraryTreeContentProvider()); IWorkbench workbench = site.getWorkbenchWindow().getWorkbench(); DecoratingStyledCellLabelProvider decorator = new DecoratingStyledCellLabelProvider( new LibraryTreeLabelProvider(), workbench.getDecoratorManager(), null); setLabelProvider(decorator); setSorter(new LibrarySorter()); final MenuManager menuManager = new MenuManager(); final Menu menu = menuManager.createContextMenu(this.getControl()); site.registerContextMenu(menuManager, this); menuManager.addMenuListener(new IMenuListener2() { private void createMenu() { libraryChainMenu.removeAll(); libraryChainMenu.add(closeLibraries); libraryMenu.removeAll(); libraryMenu.add(newLibraryAction); libraryMenu.add(openLibraryAction); libraryMenu.add(validateAction); libraryMenu.add(new Separator()); libraryMenu.add(manageInMenu); libraryMenu.add(versionMenu); libraryMenu.add(commitLibraryAction); libraryMenu.add(lockLibraryAction); libraryMenu.add(unlockLibraryAction); libraryMenu.add(finalizeLibraryAction); libraryMenu.add(new Separator()); libraryMenu.add(saveSelectedLibrariesAction); libraryMenu.add(saveAllLibrariesAction); libraryMenu.add(new Separator()); libraryMenu.add(closeLibraries); projectMenu.removeAll(); projectMenu.add(closeProjectAction); projectMenu.add(newProjectAction); projectMenu.add(openProjectAction); projectMenu.add(compileAction); whereUsedMenu.removeAll(); whereUsedMenu.add(replaceAction); navigationMenu.removeAll(); navigationMenu.add(newComplexAction); componentMenu.removeAll(); componentMenu.add(addAliasAction); componentMenu.add(addPropertiesAction); componentMenu.add(addPropertiesAction); componentMenu.add(new Separator()); componentMenu.add(addCustomFacetAction); componentMenu.add(addQueryFacetAction); componentMenu.add(addRoleAction); componentMenu.add(addEnumValueAction); componentMenu.add(new Separator()); componentMenu.add(changeObjectAction); componentMenu.add(cloneObjectAction); componentMenu.add(deleteObjectAction); componentMenu.add(copyMenu); componentMenu.add(moveMenu); componentMenu.add(validateAction); componentMenu.add(new Separator()); componentMenu.add(newComplexAction); facetMenu.removeAll(); facetMenu.add(addPropertiesAction); facetMenu.add(addRoleAction); facetMenu.add(addEnumValueAction); facetMenu.add(new Separator()); facetMenu.add(changeObjectAction); facetMenu.add(deleteObjectAction); facetMenu.add(addCustomFacetAction); facetMenu.add(addQueryFacetAction); facetMenu.add(new Separator()); facetMenu.add(newComplexAction); propertyMenu.removeAll(); propertyMenu.add(addPropertiesAction); propertyMenu.add(deleteObjectAction); propertyMenu.add(addRoleAction); propertyMenu.add(addEnumValueAction); propertyMenu.add(new Separator()); propertyMenu.add(newComplexAction); basicObjectMenu.removeAll(); basicObjectMenu.add(newComplexAction); basicObjectMenu.add(copyMenu); roleObjectMenu.removeAll(); roleObjectMenu.add(addRoleAction); roleObjectMenu.add(new Separator()); roleObjectMenu.add(newComplexAction); basicWithCopyDeleteMoveMenu.removeAll(); basicWithCopyDeleteMoveMenu.add(copyMenu); basicWithCopyDeleteMoveMenu.add(deleteObjectAction); basicWithCopyDeleteMoveMenu.add(moveMenu); basicWithCopyDeleteMoveMenu.add(new Separator()); basicWithCopyDeleteMoveMenu.add(newComplexAction); simpleObjectMenu.removeAll(); simpleObjectMenu.add(cloneObjectAction); simpleObjectMenu.add(deleteObjectAction); simpleObjectMenu.add(moveMenu); simpleObjectMenu.add(copyMenu); simpleObjectMenu.add(new Separator()); simpleObjectMenu.add(newComplexAction); enumObjectMenu.removeAll(); enumObjectMenu.add(addPropertiesAction); enumObjectMenu.add(addEnumValueAction); enumObjectMenu.add(new Separator()); enumObjectMenu.add(changeObjectAction); enumObjectMenu.add(cloneObjectAction); enumObjectMenu.add(moveMenu); enumObjectMenu.add(copyMenu); enumObjectMenu.add(deleteObjectAction); enumObjectMenu.add(new Separator()); enumObjectMenu.add(newComplexAction); operationObjectMenu.removeAll(); operationObjectMenu.add(addPropertiesAction); operationObjectMenu.add(new Separator()); operationObjectMenu.add(deleteObjectAction); operationObjectMenu.add(new Separator()); operationObjectMenu.add(newComplexAction); xpFacetObjectMenu.removeAll(); xpFacetObjectMenu.add(addPropertiesAction); xpFacetObjectMenu.add(new Separator()); xpFacetObjectMenu.add(moveMenu); xpFacetObjectMenu.add(copyMenu); xpFacetObjectMenu.add(deleteObjectAction); xpFacetObjectMenu.add(new Separator()); xpFacetObjectMenu.add(newComplexAction); serviceObjectMenu.removeAll(); serviceObjectMenu.add(addOperationAction); serviceObjectMenu.add(addCrudqOperationsAction); serviceObjectMenu.add(new Separator()); serviceObjectMenu.add(deleteObjectAction); serviceObjectMenu.add(new Separator()); serviceObjectMenu.add(newComplexAction); } @Override public void menuAboutToShow(final IMenuManager manager) { createMenu(); if (NavigatorMenus.this.getSelection().isEmpty()) { manager.add(libraryMenu); manager.add(projectMenu); } else if (NavigatorMenus.this.getSelection() instanceof IStructuredSelection) { final IStructuredSelection selection = (IStructuredSelection) NavigatorMenus.this .getSelection(); final Object selected = selection.getFirstElement(); if (!(selected instanceof Node)) { return; } final Node node = (Node) selected; // Prepare the dynamic list menus copyMenu.removeAll(); moveMenu.removeAll(); manageInMenu.removeAll(); manager.updateAll(true); manageInMenu.setVisible(true); versionMenu.removeAll(); if (node.getLibrary() != null && node.getLibrary().isManaged()) versionMenu.setVisible(true); // Set up cascade menus for (final Action action : createVersionActions(node)) { versionMenu.add(action); } for (final Action libAction : createImportActionsForLibraries(node)) { copyMenu.add(libAction); } for (final Action libAction : createMoveActionsForLibraries(node)) { moveMenu.add(libAction); } for (final Action action : createRepositoryActionsForLibraries(node)) { manageInMenu.add(action); if (node instanceof LibraryNode) { if (((LibraryNode) node).getProjectItem() != null && ((LibraryNode) node).isManaged()) { // && !((LibraryNode) node).getProjectItem().getState() // .equals(RepositoryItemState.UNMANAGED)) { // manageInMenu.setVisible(false); } } } if (node.isXsdType() || node.isXSDSchema()) { // You can only import nodes representing XSD types. manager.add(basicObjectMenu); manager.add(libraryMenu); } else if (node instanceof TypeNode) { manager.add(whereUsedMenu); } else if (node instanceof ProjectNode || node instanceof LibraryNode || node instanceof LibraryChainNode || node instanceof NavNode) { if (node.isInTLLibrary() || node instanceof NavNode) { manager.add(navigationMenu); } manager.add(libraryMenu); manager.add(projectMenu); } else if (node instanceof FamilyNode) { if (node.isInTLLibrary()) { manager.add(basicWithCopyDeleteMoveMenu); } else { manager.add(basicObjectMenu); } manager.add(libraryMenu); } else if (node instanceof ComponentNode) { if (node.isInModel()) { if (!node.isEditable()) { manager.add(basicObjectMenu); } else if (node.isService()) { manager.add(serviceObjectMenu); } else if (node.isOperation()) { manager.add(operationObjectMenu); } else if (node instanceof BusinessObjectNode) { manager.add(componentMenu); } else if (node instanceof CoreObjectNode) { manager.add(componentMenu); } else if (node instanceof VWA_Node) { manager.add(componentMenu); } else if (node.isEnumeration()) { manager.add(componentMenu); } else if (node.isAlias()) { manager.add(componentMenu); } else if (node.isFacet()) { manager.add(facetMenu); } else if (node.isFacetAlias()) { manager.add(facetMenu); } else if (node instanceof ExtensionPointNode) { manager.add(xpFacetObjectMenu); } else if (node.isSimpleType()) { manager.add(simpleObjectMenu); } else if (node instanceof SimpleAttributeNode) { } else if (node.isRoleProperty()) { manager.add(roleObjectMenu); } else if (node instanceof EnumLiteralNode) { manager.add(enumObjectMenu); } else if (node.isProperty()) { manager.add(propertyMenu); } else if (node.isImportable()) { manager.add(copyMenu); } } manager.add(libraryMenu); manager.add(projectMenu); } } manager.updateAll(true); } private List<Action> createImportActionsForLibraries(final Node context) { final List<Action> libActions = new ArrayList<Action>(); for (final LibraryNode ln : getListOfLibraries(context)) { final StringProperties sp = new DefaultStringProperties(); sp.set(PropertyType.TEXT, ln.getName()); libActions.add(new ImportObjectToLibraryAction(mainWindow, sp, ln)); } return libActions; } private List<Action> createMoveActionsForLibraries(final Node menuContext) { final List<Action> libActions = new ArrayList<Action>(); if (menuContext.getLibrary() == null || !menuContext.getLibrary().isMoveable()) return libActions; // No moves for xsd/builtin library members for (final LibraryNode ln : getListOfLibraries(menuContext)) { final StringProperties sp = new DefaultStringProperties(); sp.set(PropertyType.TEXT, ln.getName()); libActions.add(new MoveObjectToLibraryAction(sp, ln)); } return libActions; } private List<Action> createVersionActions(Node node) { final List<Action> actions = new ArrayList<Action>(); actions.add(new VersionMajorAction()); actions.add(new VersionMinorAction()); actions.add(new VersionPatchAction()); return actions; } private List<LibraryNode> getListOfLibraries(final Node node) { final List<LibraryNode> libs = new ArrayList<LibraryNode>(); for (final LibraryNode ln : Node.getAllUserLibraries()) { if (ln.isInChain()) { // add if it is not in the node's chain and the head of the chain if (!ln.getChain().contains(node) && ln.isEditable()) libs.add(ln); } else if (ln != node.getLibrary() && ln.isEditable()) { libs.add(ln); } } return libs; } @Override public void menuAboutToHide(IMenuManager manager) { // clean the status on menu close contributed by DisableIfEmptyMenu. // TODO: clean status on menu selection change. Right now we can only catch // SWT.ArmEvent (menu selection) There is missing on exit event. OtmRegistry.getMainController().postStatus(" "); } }); menuManager.setRemoveAllWhenShown(true); getControl().setMenu(menu); }
From source file:org.talend.designer.runtime.visualization.views.JvmTreeViewer.java
License:Open Source License
/** * The constructor.//from w w w.ja va 2s .c o m * * @param parent the parent composite * @param style the style * @param actionBars The action bars */ public JvmTreeViewer(Composite parent, int style, IActionBars actionBars) { super(parent, style); statusLineManager = actionBars.getStatusLineManager(); statusLineItem = new StatusLineContributionItem("StatusLineContributionItem"); //$NON-NLS-1$ statusLineManager.add(statusLineItem); setContentProvider(new JvmTreeContentProvider()); setLabelProvider(new DecoratingStyledCellLabelProvider(new JvmTreeLabelProvider(), PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator(), null)); createContextMenu(actionBars); addListeners(); new Job(Messages.initializeJvmExplorer) { @Override protected IStatus run(IProgressMonitor monitor) { // make sure not to instantiate JVM model in UI thread JvmModel.getInstance(); Display.getDefault().asyncExec(new Runnable() { @Override public void run() { setInput(new Object[0]); JvmModel.getInstance().addJvmModelChangeListener(JvmTreeViewer.this); TreeItem topItem = getTree().getTopItem(); if (topItem != null) { topItem.setExpanded(true); refresh(); } } }); return Status.OK_STATUS; } }.schedule(); }
From source file:org.talend.mdm.repository.ui.dialogs.consistency.ConsistencyConflictDialog.java
License:Open Source License
private void installColumns() { treeViewer.getTree().setHeaderVisible(true); nameColumn = new TreeViewerColumn(treeViewer, SWT.NONE); nameColumn.getColumn().setWidth(320); nameColumn.getColumn().setText(Messages.ConsistencyConflict_name); ILabelDecorator labelDecorator = RepositoryPlugin.getDefault().getWorkbench().getDecoratorManager() .getLabelDecorator();//from www . ja v a 2 s . c o m DecoratingStyledCellLabelProvider consistencyLabelProvider = new DecoratingStyledCellLabelProvider( new MDMRepositoryLabelProvider(), labelDecorator, null) { @Override public Color getBackground(Object element) { IRepositoryViewObject viewObj = (IRepositoryViewObject) element; return getBackgroundColor(viewObj); } }; nameColumn.setLabelProvider(consistencyLabelProvider); resultColumn = new TreeViewerColumn(treeViewer, SWT.NONE); resultColumn.getColumn().setWidth(120); resultColumn.getColumn().setText(Messages.ConsistencyConflict_compareResult); resultColumn.setLabelProvider(new CompareResultColumnProvider()); // operationColumn = new TreeViewerColumn(treeViewer, SWT.NONE); operationColumn.getColumn().setWidth(120); operationColumn.getColumn().setText(Messages.ConsistencyConflictDialog_Operation); operationColumn.setLabelProvider(new OperationProvider()); // localTimeColumn = new TreeViewerColumn(treeViewer, SWT.NONE); localTimeColumn.getColumn().setText(Messages.ConsistencyConflict_retrievalTimestamp); localTimeColumn.setLabelProvider(new TimeStampColumnProvider(true)); // serverTimeColumn = new TreeViewerColumn(treeViewer, SWT.NONE); serverTimeColumn.getColumn().setText(Messages.ConsistencyConflict_serverTimestamp); serverTimeColumn.setLabelProvider(new TimeStampColumnProvider(false)); // showTimeStampColumns(false); }
From source file:org.talend.mdm.repository.ui.widgets.RepositoryViewObjectCheckedWidget.java
License:Open Source License
private void installColumns() { treeViewer.getTree().setHeaderVisible(true); ////from w ww. jav a2 s . com TreeViewerColumn nameColumn = new TreeViewerColumn(treeViewer, SWT.NONE); nameColumn.getColumn().setWidth(320); nameColumn.getColumn().setText(Messages.ConsistencyConflict_name); ILabelDecorator labelDecorator = RepositoryPlugin.getDefault().getWorkbench().getDecoratorManager() .getLabelDecorator(); DecoratingStyledCellLabelProvider consistencyLabelProvider = new DecoratingStyledCellLabelProvider( new MDMRepositoryLabelProvider(), labelDecorator, null); nameColumn.setLabelProvider(consistencyLabelProvider); // compare result TreeViewerColumn resultColumn = new TreeViewerColumn(treeViewer, SWT.NONE); resultColumn.getColumn().setWidth(120); resultColumn.getColumn().setText(Messages.ConsistencyConflict_compareResult); resultColumn.setLabelProvider(new CompareResultColumnProvider()); // localTimeColumn = new TreeViewerColumn(treeViewer, SWT.NONE); localTimeColumn.getColumn().setText(Messages.ConsistencyConflict_retrievalTimestamp); localTimeColumn.setLabelProvider(new TimeStampColumnProvider(true)); // serverTimeColumn = new TreeViewerColumn(treeViewer, SWT.NONE); serverTimeColumn.getColumn().setText(Messages.ConsistencyConflict_serverTimestamp); serverTimeColumn.setLabelProvider(new TimeStampColumnProvider(false)); // showTimeStampColumns(false); }