类org.eclipse.ui.internal.WorkbenchWindow源码实例Demo

下面列出了怎么用org.eclipse.ui.internal.WorkbenchWindow的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: eclipse-encoding-plugin   文件: ActiveDocument.java
private void setMessage(String imageIconKey, String message, Object... args) {
	IStatusLineManager statusLineManager = null;
	if (editor == null) {
		WorkbenchWindow window = (WorkbenchWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow();
		statusLineManager = window.getActionBars().getStatusLineManager();
	} else {
		statusLineManager = editor.getEditorSite().getActionBars().getStatusLineManager();
	}
	if (statusLineManager != null) {
		if (message == null) {
			statusLineManager.setMessage(null);
		} else {
			statusLineManager.setMessage(Activator.getImage(imageIconKey), format(message, args));
		}
	}
}
 
源代码2 项目: gama   文件: GamlReferenceSearch.java
public static void install() {
	WorkbenchHelper.runInUI("Install GAML Search", 0, m -> {
		final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
		if (window instanceof WorkbenchWindow) {
			final MTrimBar topTrim = ((WorkbenchWindow) window).getTopTrim();
			for (final MTrimElement element : topTrim.getChildren()) {
				if ("SearchField".equals(element.getElementId())) {
					final Composite parent = ((Control) element.getWidget()).getParent();
					final Control old = (Control) element.getWidget();
					WorkbenchHelper.runInUI("Disposing old search control", 500, m2 -> old.dispose());
					element.setWidget(GamlSearchField.installOn(parent));
					parent.layout(true, true);
					parent.update();
					break;
				}
			}
		}
	});
}
 
源代码3 项目: APICloud-Studio   文件: UIUtils.java
public static void setCoolBarVisibility(boolean visible)
{
	IWorkbenchWindow activeWorkbenchWindow = getActiveWorkbenchWindow();
	if (activeWorkbenchWindow instanceof WorkbenchWindow)
	{
		WorkbenchWindow workbenchWindow = (WorkbenchWindow) activeWorkbenchWindow;
		workbenchWindow.setCoolBarVisible(visible);
		workbenchWindow.setPerspectiveBarVisible(visible);

		// Try to force a refresh of the text on the action
		IWorkbenchPart activePart = getActivePart();
		if (activePart != null)
		{
			ICommandService cmdService = (ICommandService) activePart.getSite().getService(ICommandService.class);
			cmdService.refreshElements("org.eclipse.ui.ToggleCoolbarAction", null); //$NON-NLS-1$
		}
	}
}
 
源代码4 项目: slr-toolkit   文件: MendeleyOverlayDecorator.java
/**
 * THis method sets the main menu contribution 'Mendeley' to visible
 */
private void updateMenuContribution() {
	if(window instanceof WorkbenchWindow) {
		MenuManager menuManager = ((WorkbenchWindow)window).getMenuManager();
	    
	    //you'll need to find the id for the item
	    String mainMenuId = "de.tudresden.slr.model.mendeley.menus.mainMenu";
	    IContributionItem item = menuManager.find(mainMenuId);
	    item.update();
	    if (item != null) {
	        // clean old one
	        item.setVisible(true);

	        // refresh menu gui
	        menuManager.update();
	    }
	}
}
 
源代码5 项目: gama   文件: PerspectiveHelper.java
public static void showBottomTray(final WorkbenchWindow window, final Boolean show) {

		final MUIElement trimStatus = getTrimStatus(window);
		if ( trimStatus != null ) {
			// toggle statusbar visibility
			trimStatus.setVisible(show);
		}

	}
 
源代码6 项目: APICloud-Studio   文件: UIUtils.java
public static boolean getCoolBarVisibility()
{
	IWorkbench workbench = PlatformUI.getWorkbench();
	if (workbench != null)
	{
		IWorkbenchWindow activeWorkbenchWindow = getActiveWorkbenchWindow();
		if (activeWorkbenchWindow instanceof WorkbenchWindow)
		{
			return ((WorkbenchWindow) activeWorkbenchWindow).getCoolBarVisible();
		}
	}
	return true;
}
 
源代码7 项目: translationstudio8   文件: OpenToolBarHandler.java
public Object execute(ExecutionEvent event) throws ExecutionException {
	final IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindowChecked(event);
	if (activeWorkbenchWindow instanceof WorkbenchWindow) {
		WorkbenchWindow window = (WorkbenchWindow) activeWorkbenchWindow;
		window.toggleToolbarVisibility();
	}
	
	ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
	commandService.refreshElements(event.getCommand().getId(), null);
	
	return null;
}
 
源代码8 项目: translationstudio8   文件: OpenToolBarHandler.java
@SuppressWarnings("rawtypes")
public void updateElement(final UIElement element, Map parameters) {
	Display.getDefault().asyncExec(new Runnable() {
		public void run() {
			final IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
			if (activeWorkbenchWindow instanceof WorkbenchWindow) {
				WorkbenchWindow window = (WorkbenchWindow) activeWorkbenchWindow;
				boolean coolbarVisible = window.getCoolBarVisible();
				element.setIcon(coolbarVisible ? Activator.getImageDescriptor("icons/enabled_co.png") : Activator
						.getImageDescriptor("icons/disabled_co.png"));
			}
		}
	});
	
}
 
源代码9 项目: translationstudio8   文件: PluginConfigManage.java
@SuppressWarnings("restriction")
public PluginConfigManage() {
	pluginXmlLocation = ResourcesPlugin.getWorkspace().getRoot().getLocation()
			.append(PluginConstants.PC_pluginConfigLocation).toOSString();
	WorkbenchWindow window = (WorkbenchWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow();
	parentManager = window.getMenuBarManager();
	shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
}
 
源代码10 项目: tmxeditor8   文件: OpenToolBarHandler.java
public Object execute(ExecutionEvent event) throws ExecutionException {
	final IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindowChecked(event);
	if (activeWorkbenchWindow instanceof WorkbenchWindow) {
		WorkbenchWindow window = (WorkbenchWindow) activeWorkbenchWindow;
		window.toggleToolbarVisibility();
	}
	
	ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
	commandService.refreshElements(event.getCommand().getId(), null);
	
	return null;
}
 
源代码11 项目: tmxeditor8   文件: OpenToolBarHandler.java
@SuppressWarnings("rawtypes")
public void updateElement(final UIElement element, Map parameters) {
	Display.getDefault().asyncExec(new Runnable() {
		public void run() {
			final IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
			if (activeWorkbenchWindow instanceof WorkbenchWindow) {
				WorkbenchWindow window = (WorkbenchWindow) activeWorkbenchWindow;
				boolean coolbarVisible = window.getCoolBarVisible();
				element.setIcon(coolbarVisible ? Activator.getImageDescriptor("icons/enabled_co.png") : Activator
						.getImageDescriptor("icons/disabled_co.png"));
			}
		}
	});
	
}
 
源代码12 项目: tmxeditor8   文件: PluginConfigManage.java
@SuppressWarnings("restriction")
public PluginConfigManage() {
	pluginXmlLocation = ResourcesPlugin.getWorkspace().getRoot().getLocation()
			.append(PluginConstants.PC_pluginConfigLocation).toOSString();
	WorkbenchWindow window = (WorkbenchWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow();
	parentManager = window.getMenuBarManager();
	shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
}
 
源代码13 项目: e4macs   文件: BrowseKillRingHandler.java
/**
 * Insert text from kill ring entry into the most recently activated text editor
 * 
 * @param text - the text from the kill ring entry
 */
//	@SuppressWarnings("restriction")	// for cast to internal org.eclipse.ui.internal.WorkbenchWindow
private void insertFromBrowseRing(String text) {
	// insert into most recently active editor
	IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
	RecentEditor recent = getRecentEditor();
	// use widget to avoid unpleasant scrolling side effects of IRewriteTarget		
	Control widget = MarkUtils.getTextWidget(recent.editor);
	if (recent.editor != null) {
		try {
			// cache for ancillary computations
			setThisEditor(recent.editor);
			// reduce the amount of unnecessary work
			if (window instanceof WorkbenchWindow) {
				((WorkbenchWindow) window).largeUpdateStart();
			}
			widget.setRedraw(false);
			recent.page.activate(recent.epart);
			insertText(recent.editor.getDocumentProvider().getDocument(recent.editor.getEditorInput()),
					(ITextSelection)recent.editor.getSelectionProvider().getSelection(), text);
		} catch (Exception e) {
		} finally {
			widget.setRedraw(true);
			setThisEditor(null);
			if (window instanceof WorkbenchWindow) {
				((WorkbenchWindow) window).largeUpdateEnd();
			}
		}
	} else {
		beep();
	}
}
 
源代码14 项目: bonita-studio   文件: DummyEditorSite.java
@Override
public Shell getShell() {

    // Compatibility: This method should not be used outside the UI
    // thread... but since this condition
    // was not always in the JavaDoc, we still try to return our best guess
    // about the shell if it is
    // called from the wrong thread.
    final Display currentDisplay = Display.getCurrent();
    if (currentDisplay == null) {
        // Uncomment this to locate places that try to access the shell from
        // a background thread
        // WorkbenchPlugin.log(new Exception("Error:
        // IWorkbenchSite.getShell() was called outside the UI thread. Fix
        // this code.")); //$NON-NLS-1$

        final IWorkbenchWindow workbenchWindow = getWorkbenchWindow();
        if (workbenchWindow != null) {
            return workbenchWindow.getShell();
        }
        return null;
    }
    IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    MWindow window = null;
    if (activeWorkbenchWindow != null) {
        window = ((WorkbenchWindow) activeWorkbenchWindow).getModel();
        final Control control = (Control) window.getWidget();
        if (control != null && !control.isDisposed()) {
            return control.getShell();
        }
    }
    // likely means the part has been destroyed, return the parent window's
    // shell, we don't just arbitrarily return the workbench window's shell
    // because we may be in a detached window
    return window == null ? getWorkbenchWindow().getShell() : (Shell) window.getWidget();
}
 
源代码15 项目: bonita-studio   文件: NormalCoolBarHandler.java
public Object execute(ExecutionEvent event) throws ExecutionException {
	MWindow model = ((WorkbenchWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow()).getModel();
	EModelService modelService = model.getContext().get(EModelService.class);
	MToolControl bonitaCoolBar = (MToolControl) modelService.find(
			"BonitaCoolbar", model);
	if(bonitaCoolBar != null){
		CoolbarToolControl coolbarControl = (CoolbarToolControl) bonitaCoolBar.getObject();
		coolbarControl.maximizeCoolbar();
	}
	return null;
}
 
源代码16 项目: bonita-studio   文件: SmallCoolBarHandler.java
public Object execute(ExecutionEvent event) throws ExecutionException {
	MWindow model = ((WorkbenchWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow()).getModel();
	EModelService modelService = model.getContext().get(EModelService.class);
	MToolControl bonitaCoolBar = (MToolControl) modelService.find(
			"BonitaCoolbar", model);
	if(bonitaCoolBar != null){
		CoolbarToolControl coolbarControl = (CoolbarToolControl) bonitaCoolBar.getObject();
		coolbarControl.minimizeCoolbar();
	}
	return null;
}
 
源代码17 项目: xds-ide   文件: WorkbenchUtils.java
public static void refreshMainMenu() {
  	IWorkbenchWindow w = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
WorkbenchWindow ww = (WorkbenchWindow)w;
  	IMenuService service = (IMenuService)w.getService(IMenuService.class);
  	service.populateContributionManager((ContributionManager)ww.getActionBars().getMenuManager(), MenuUtil.MAIN_MENU);
  }
 
源代码18 项目: xds-ide   文件: WorkbenchUtils.java
public static IMenuManager getWorkbenchMenuManager() {
  	IWorkbenchWindow w = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
WorkbenchWindow ww = (WorkbenchWindow)w;
  	return ww.getActionBars().getMenuManager();
  }
 
源代码19 项目: gama   文件: PerspectiveHelper.java
private static MUIElement getTrimStatus(final WorkbenchWindow window) {
	final EModelService modelService = window.getService(EModelService.class);
	final MUIElement searchRoot = window.getModel();
	return modelService.find(BOTTOM_TRIM_ID, searchRoot);
}
 
源代码20 项目: translationstudio8   文件: PluginConfigManage.java
@SuppressWarnings("restriction")
public PluginConfigManage(String pluginXmlLocation) {
	this.pluginXmlLocation = pluginXmlLocation;
	WorkbenchWindow window = (WorkbenchWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow();
	parentManager = window.getMenuBarManager();
}
 
源代码21 项目: tmxeditor8   文件: PluginConfigManage.java
@SuppressWarnings("restriction")
public PluginConfigManage(String pluginXmlLocation) {
	this.pluginXmlLocation = pluginXmlLocation;
	WorkbenchWindow window = (WorkbenchWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow();
	parentManager = window.getMenuBarManager();
}
 
@Override
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
    super.init(site, input);
    eclipseContext = ((WorkbenchWindow) getEditorSite().getWorkbenchWindow()).getModel().getContext();
    editorContributions = createEditorContributions();
}
 
源代码23 项目: bonita-studio   文件: AbstractEditor.java
@Override
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
    super.init(site, input);
    context = ((WorkbenchWindow) getEditorSite().getWorkbenchWindow()).getModel().getContext();
    ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
}
 
源代码24 项目: bonita-studio   文件: EmbeddedEditorSite.java
protected static MWindow getMWindow() {
    Workbench workbench = (Workbench) PlatformUI.getWorkbench();
    WorkbenchWindow activeWorkbenchWindow = (WorkbenchWindow) workbench.getActiveWorkbenchWindow();
    return activeWorkbenchWindow.getModel();
}
 
 类所在包
 同包方法