本文整理汇总了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;
}
示例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;
}
示例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);
}
}
});
}
示例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));
}
}
}
}
}
示例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);
}
}
});
}
示例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);
}
}
});
}
示例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);
}
}
});
}
示例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);
}
}
});
}
示例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;
}
示例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;
}
}
}
}
});
}
}
示例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;
}
示例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());
}
示例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;
}
示例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;
}
示例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;
}