当前位置: 首页>>代码示例>>Java>>正文


Java IWorkbenchWindow类代码示例

本文整理汇总了Java中org.eclipse.ui.IWorkbenchWindow的典型用法代码示例。如果您正苦于以下问题:Java IWorkbenchWindow类的具体用法?Java IWorkbenchWindow怎么用?Java IWorkbenchWindow使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IWorkbenchWindow类属于org.eclipse.ui包,在下文中一共展示了IWorkbenchWindow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import org.eclipse.ui.IWorkbenchWindow; //导入依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
	/*MessageDialog.openInformation(
			window.getShell(),
			"Plugin",
			"Hello, Eclipse world");*/
	
	// Pfad vom Projekt
    if (window != null)
    {
        IStructuredSelection selection = (IStructuredSelection) window.getSelectionService().getSelection();
        Object firstElement = selection.getFirstElement();
        if (firstElement instanceof IAdaptable)
        {
            IProject project = (IProject)((IAdaptable)firstElement).getAdapter(IProject.class);
            IPath path = project.getFullPath();
            System.out.println("Projekt: "+path);
            StartEGL.start(""+path);
        }
    }
	
	return null;
}
 
开发者ID:Nielko,项目名称:MBSE-Vacation-Manager,代码行数:25,代码来源:ExportHandler.java

示例2: checkCondition

import org.eclipse.ui.IWorkbenchWindow; //导入依赖的package包/类
@Override
public boolean checkCondition() throws Exception {
	Display.getDefault().syncExec(new Runnable() {
		@Override
		public void run() {
			IWorkbenchWindow ww = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
			 
			if (ww == null)
				return;
			IWorkbenchPage page = ww.getActivePage();
			if (page == null)
				return;
			IEditorReference[] part = page.getEditorReferences();
			if (part == null)
				return;
			for (IEditorReference iEditorReference : part) {
				if( title.equals(iEditorReference.getTitle()) ) 
					found = true;
			}
		}
	});
	return !found;
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:24,代码来源:EditorClosedCondition.java

示例3: testRunStarted

import org.eclipse.ui.IWorkbenchWindow; //导入依赖的package包/类
/**
 * Called before any tests have been run.
 *
 * @param description
 *            describes the tests to be run
 */
@Override
public void testRunStarted(Description description) throws Exception {
	Display.getDefault().syncExec(new Runnable() {
		@Override
		public void run() {

			IWorkbenchWindow[] windows = N4IDEXpectUIPlugin.getDefault().getWorkbench().getWorkbenchWindows();
			try {
				N4IDEXpectView view = (N4IDEXpectView) windows[0].getActivePage().showView(
						N4IDEXpectView.ID);
				view.notifySessionStarted(description);
			} catch (PartInitException e) {
				N4IDEXpectUIPlugin.logError("cannot refresh test view window", e);
			}
		}
	});
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:24,代码来源:N4IDEXpectRunListener.java

示例4: notifyDbChanged

import org.eclipse.ui.IWorkbenchWindow; //导入依赖的package包/类
public static void notifyDbChanged(DbInfo dbinfo) {
    String action = Activator.getDefault().getPreferenceStore().getString(PG_EDIT_PREF.EDITOR_UPDATE_ACTION);
    if (action.equals(PG_EDIT_PREF.NO_ACTION)) {
        return;
    }
    for (IWorkbenchWindow wnd : PlatformUI.getWorkbench().getWorkbenchWindows()) {
        for (IWorkbenchPage page : wnd.getPages()) {
            for (IEditorReference ref : page.getEditorReferences()) {
                IEditorPart ed = ref.getEditor(false);
                if (ed instanceof ProjectEditorDiffer) {
                    notifyDbChanged(dbinfo, (ProjectEditorDiffer) ed, action.equals(PG_EDIT_PREF.UPDATE));
                }
            }
        }
    }
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:17,代码来源:ProjectEditorDiffer.java

示例5: testFinished

import org.eclipse.ui.IWorkbenchWindow; //导入依赖的package包/类
/**
 * Called when an atomic test has finished, whether the test succeeds or fails.
 *
 * @param description
 *            the description of the test that just ran
 */
@Override
public void testFinished(Description description) throws Exception {
	Display.getDefault().syncExec(new Runnable() {
		@Override
		public void run() {

			IWorkbenchWindow[] windows = N4IDEXpectUIPlugin.getDefault().getWorkbench().getWorkbenchWindows();
			try {
				N4IDEXpectView view = (N4IDEXpectView) windows[0].getActivePage().showView(
						N4IDEXpectView.ID);
				view.notifyFinishedExecutionOf(description);
			} catch (PartInitException e) {
				N4IDEXpectUIPlugin.logError("cannot refresh test view window", e);
			}
		}
	});
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:24,代码来源:N4IDEXpectRunListener.java

示例6: testFailure

import org.eclipse.ui.IWorkbenchWindow; //导入依赖的package包/类
/**
 * Called when an atomic test fails.
 *
 * @param failure
 *            describes the test that failed and the exception that was thrown
 */
@Override
public void testFailure(Failure failure) throws Exception {
	Display.getDefault().syncExec(new Runnable() {
		@Override
		public void run() {

			IWorkbenchWindow[] windows = N4IDEXpectUIPlugin.getDefault().getWorkbench().getWorkbenchWindows();
			try {
				N4IDEXpectView view = (N4IDEXpectView) windows[0].getActivePage().showView(
						N4IDEXpectView.ID);
				view.notifyFailedExecutionOf(failure);
			} catch (PartInitException e) {
				N4IDEXpectUIPlugin.logError("cannot refresh test view window", e);
			}
		}
	});
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:24,代码来源:N4IDEXpectRunListener.java

示例7: testAssumptionFailure

import org.eclipse.ui.IWorkbenchWindow; //导入依赖的package包/类
/**
 * Called when an atomic test flags that it assumes a condition that is false
 *
 * describes the test that failed and the {@link AssumptionViolatedException} that was thrown
 */
@Override
public void testAssumptionFailure(Failure failure) {
	Display.getDefault().syncExec(new Runnable() {
		@Override
		public void run() {

			IWorkbenchWindow[] windows = N4IDEXpectUIPlugin.getDefault().getWorkbench().getWorkbenchWindows();
			try {
				N4IDEXpectView view = (N4IDEXpectView) windows[0].getActivePage().showView(
						N4IDEXpectView.ID);
				view.notifyFailedExecutionOf(failure);
			} catch (PartInitException e) {
				N4IDEXpectUIPlugin.logError("cannot refresh test view window", e);
			}
		}
	});
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:23,代码来源:N4IDEXpectRunListener.java

示例8: testIgnored

import org.eclipse.ui.IWorkbenchWindow; //导入依赖的package包/类
/**
 * Called when a test will not be run, generally because a test method is annotated with {@link org.junit.Ignore}.
 *
 * @param description
 *            describes the test that will not be run
 */
@Override
public void testIgnored(Description description) throws Exception {
	Display.getDefault().syncExec(new Runnable() {
		@Override
		public void run() {

			IWorkbenchWindow[] windows = N4IDEXpectUIPlugin.getDefault().getWorkbench().getWorkbenchWindows();
			try {
				N4IDEXpectView view = (N4IDEXpectView) windows[0].getActivePage().showView(
						N4IDEXpectView.ID);
				view.notifyIgnoredExecutionOf(description);
			} catch (PartInitException e) {
				N4IDEXpectUIPlugin.logError("cannot refresh test view window", e);
			}
		}
	});
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:24,代码来源:N4IDEXpectRunListener.java

示例9: execute

import org.eclipse.ui.IWorkbenchWindow; //导入依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {

	IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelectionChecked(event);

	IWorkbenchWindow[] windows = N4IDEXpectUIPlugin.getDefault().getWorkbench().getWorkbenchWindows();
	try {
		view = (N4IDEXpectView) windows[0].getActivePage().showView(
				N4IDEXpectView.ID);
	} catch (PartInitException e) {
		N4IDEXpectUIPlugin.logError("cannot refresh test view window", e);
	}

	Description desc = (Description) selection.getFirstElement();
	if (desc.isTest() && view.testsExecutionStatus.hasFailed(desc)) {
		Throwable failureException = view.testsExecutionStatus.getFailure(desc).getException();

		if (failureException instanceof ComparisonFailure) {
			ComparisonFailure cf = (ComparisonFailure) failureException;
			// display comparison view
			displayComparisonView(cf, desc);
		}
	}
	return null;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:26,代码来源:XpectCompareCommandHandler.java

示例10: tryValidateManifestInEditor

import org.eclipse.ui.IWorkbenchWindow; //导入依赖的package包/类
private void tryValidateManifestInEditor(final IResourceDelta delta) {
	if (isWorkbenchRunning()) {
		Display.getDefault().asyncExec(() -> {
			final IWorkbenchWindow window = getWorkbench().getActiveWorkbenchWindow();
			if (null != window) {
				final IWorkbenchPage page = window.getActivePage();
				for (final IEditorReference editorRef : page.getEditorReferences()) {
					if (isEditorForResource(editorRef, delta.getResource())) {
						final IWorkbenchPart part = editorRef.getPart(true);
						if (part instanceof XtextEditor) {
							editorCallback.afterSave((XtextEditor) part);
							return;
						}
					}
				}
			}
		});
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:20,代码来源:N4JSAllContainersState.java

示例11: execute

import org.eclipse.ui.IWorkbenchWindow; //导入依赖的package包/类
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
  this.decoratorManager = Activator.getDefault().getWorkbench().getDecoratorManager();

  if (!this.isHidden) {
    this.isHidden = true;
    this.setStore(false);
    this.setDecorator(false);
  } else {
    this.isHidden = false;
    this.setStore(true);
    this.setDecorator(true);
  }
  this.store.needsSaving();

  final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
  final ICommandService commandService = window.getService(ICommandService.class);
  if (commandService != null) {
    commandService.refreshElements(COMMAND_ID, null);
  }
  return null;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:23,代码来源:MarkerVisibilityHandler.java

示例12: testGenerateFromFile

import org.eclipse.ui.IWorkbenchWindow; //导入依赖的package包/类
@Test
public void testGenerateFromFile() throws Exception {
	IWorkbenchWindow iww = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
	IJavaProject pj = ProjectHelper.getOrCreateSimpleGW4EProject(PROJECT_NAME,true,false);
	IFile file = (IFile) ResourceManager.getResource(pj.getProject().getFullPath().append("src/test/resources/Simple.json").toString());

			
	GraphWalkerFacade.generateFromFile(iww, GenerationFactory.get(file), new NullProgressMonitor());
	
	IFile interf = (IFile) ResourceManager.getResource(
			pj.getProject().getFullPath().append("target/generated-test-sources/Simple.java").toString());
	assertTrue(interf.exists());
	IFile impl = (IFile) ResourceManager
			.getResource(pj.getProject().getFullPath().append("src/test/java/SimpleImpl.java").toString());
	assertTrue(impl.exists());
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:17,代码来源:GraphWalkerFacadeTest.java

示例13: closeEditorIfAlreadyOpen

import org.eclipse.ui.IWorkbenchWindow; //导入依赖的package包/类
private boolean closeEditorIfAlreadyOpen(IPath jobFilePath, String fileName) {

		String jobPathRelative = StringUtils.removeStart(jobFilePath.toString(), "..");
		jobPathRelative = StringUtils.removeStart(jobPathRelative, "/");
		String jobPathAbsolute = StringUtils.replace(jobPathRelative, "/", "\\");
		IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
		if (activeWorkbenchWindow != null) {
			IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
			for (IEditorReference editorRefrence : activePage.getEditorReferences()) {
				if (StringUtils.equals(editorRefrence.getTitleToolTip(), jobPathRelative)
						|| StringUtils.equals(editorRefrence.getTitleToolTip(), jobPathAbsolute)
						|| fileName.equals(editorRefrence.getTitleToolTip())) {
					IEditorPart editor = editorRefrence.getEditor(true);
					if (!activePage.closeEditor(editor, true)) {
						LOGGER.debug("Editor not closed");
					}
					LOGGER.debug("Editor closed");
					return true;
				}
			}
		}
		return false;
	}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:24,代码来源:ExternalSchemaUpdaterHandler.java

示例14: execute

import org.eclipse.ui.IWorkbenchWindow; //导入依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	IWorkbench workbench = PlatformUI.getWorkbench();
	if (workbench==null){
		return null;
	}
	IWorkbenchWindow activeWorkbenchWindow = workbench.getActiveWorkbenchWindow();
	if (activeWorkbenchWindow==null){
		return null;
	}
	IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
	if (activePage==null){
		return null;
	}
	IEditorPart editor = activePage.getActiveEditor();
	
	if (editor instanceof BatchEditor){
		executeOnBatchEditor((BatchEditor) editor);
	}
	return null;
}
 
开发者ID:de-jcup,项目名称:eclipse-batch-editor,代码行数:22,代码来源:AbstractBatchEditorHandler.java

示例15: execute

import org.eclipse.ui.IWorkbenchWindow; //导入依赖的package包/类
public Object execute(ExecutionEvent event) throws ExecutionException {

		final INewWizard wizard = new NewModelWizard();

		// Initialize the selection
		final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
		final ISelectionService service = window.getSelectionService();
		final IStructuredSelection selection = (IStructuredSelection)service
				.getSelection("org.eclipse.sirius.ui.tools.views.model.explorer"); //$NON-NLS-1$
		wizard.init(PlatformUI.getWorkbench(), selection);

		// Open the new model wizard
		final WizardDialog dialog = new WizardDialog(window.getShell(), wizard);
		dialog.open();
		return null;
	}
 
开发者ID:polarsys,项目名称:time4sys,代码行数:17,代码来源:NewTime4SysModel.java


注:本文中的org.eclipse.ui.IWorkbenchWindow类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。