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


Java HandlerUtil.getActiveShell方法代码示例

本文整理汇总了Java中org.eclipse.ui.handlers.HandlerUtil.getActiveShell方法的典型用法代码示例。如果您正苦于以下问题:Java HandlerUtil.getActiveShell方法的具体用法?Java HandlerUtil.getActiveShell怎么用?Java HandlerUtil.getActiveShell使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.ui.handlers.HandlerUtil的用法示例。


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

示例1: execute

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

		ISelection sel = HandlerUtil.getCurrentSelection(event);
		if (sel.isEmpty())
			return null;
		if (!(sel instanceof IStructuredSelection))
			return null;
		Object obj = ((IStructuredSelection) sel).getFirstElement();
		if (!(obj instanceof IFile))
			return null;
 
		try {
			ConvertToFileCreationWizard wizard = new ConvertToFileCreationWizard( );
			wizard.init(PlatformUI.getWorkbench(), (IStructuredSelection)sel);
			Shell activeShell = HandlerUtil.getActiveShell(event);
			if (activeShell==null) return null;
			WizardDialog dialog = new WizardDialog(activeShell,wizard);
			dialog.open();
		} catch (Exception e) {
			ResourceManager.logException(e);
		}
 
		return null;
	}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:25,代码来源:ConvertToHandler.java

示例2: execute

import org.eclipse.ui.handlers.HandlerUtil; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) {
    IWorkbenchPart part = HandlerUtil.getActiveEditor(event);

    if (part instanceof SQLEditor){
        SQLEditor sqlEditor = (SQLEditor) part;

        if (sqlEditor.getCurrentDb() != null) {
            sqlEditor.updateDdl();
        } else {
            MessageBox mb = new MessageBox(HandlerUtil.getActiveShell(event), SWT.ICON_INFORMATION);
            mb.setText(Messages.UpdateDdl_select_source);
            mb.setMessage(Messages.UpdateDdl_select_source_msg);
            mb.open();
        }
    }
    return null;
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:19,代码来源:UpdateDdl.java

示例3: openDialog

import org.eclipse.ui.handlers.HandlerUtil; //导入方法依赖的package包/类
private ICoverageLaunch openDialog(ExecutionEvent event,
    List<ICoverageLaunch> launches) {
  final ListDialog dialog = new ListDialog(HandlerUtil.getActiveShell(event)) {
    @Override
    protected void configureShell(Shell shell) {
      super.configureShell(shell);
      ContextHelp.setHelp(shell, ContextHelp.DUMP_EXECUTION_DATA);
    }
  };
  dialog.setTitle(UIMessages.DumpExecutionDataDialog_title);
  dialog.setMessage(UIMessages.DumpExecutionDataDialog_message);
  dialog.setContentProvider(ArrayContentProvider.getInstance());
  dialog.setLabelProvider(new LaunchLabelProvider());
  dialog.setInput(launches);
  if (dialog.open() == Dialog.OK && dialog.getResult().length == 1) {
    return (ICoverageLaunch) dialog.getResult()[0];
  }
  return null;
}
 
开发者ID:eclipse,项目名称:eclemma,代码行数:20,代码来源:DumpExecutionDataHandler.java

示例4: execute

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

	Shell activeShell = HandlerUtil.getActiveShell(event);
	IRunnableWithProgress runner = ProjectSourceUtil.getRunner();

	try
	{
		new ProgressMonitorDialog( activeShell ).run( true, false, runner );

	}
	catch( InvocationTargetException | InterruptedException e )
	{
		Throwable t = (e instanceof InvocationTargetException) ? e.getCause() : e;
		MessageDialog.openError( activeShell, "Error detaching sources", t.toString() );
	}

	return null;
}
 
开发者ID:SAP,项目名称:hybris-commerce-eclipse-plugin,代码行数:21,代码来源:DetachSourcesHandler.java

示例5: execute

import org.eclipse.ui.handlers.HandlerUtil; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
	ImageView imageView = (ImageView) activePart;
	SWTImageCanvas imageCanvas = imageView.imageCanvas;
	if (imageCanvas == null) {
		return null;
	}

	Shell shell = HandlerUtil.getActiveShell(event);

	FileDialog dialog = new FileDialog(shell, SWT.SAVE);
	dialog.setFilterExtensions(new String[] { "*.png", "*.*" });
	dialog.setFilterNames(new String[] { "PNG Files", "All Files" });
	String fileSelected = dialog.open();

	if (fileSelected != null) {
		ImageLoader imageLoader = new ImageLoader();
		imageLoader.data = new ImageData[] { imageCanvas.getImageData() };

		System.out.println("Selected file: " + fileSelected);
		imageLoader.save(fileSelected, SWT.IMAGE_PNG);
	}

	return null;
}
 
开发者ID:NineWorlds,项目名称:xstreamer,代码行数:27,代码来源:ImageViewSaveAsHandler.java

示例6: execute

import org.eclipse.ui.handlers.HandlerUtil; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
	if (selection.isEmpty()) {
		return null;
	}
	List<Bookmark> bookmarks = new ArrayList<>(
			getBookmarksToDelete(bookmarkDatabase.getBookmarksTree(), selection));
	ConfirmDeleteDialog dialog = new ConfirmDeleteDialog(HandlerUtil.getActiveShell(event), bookmarks);
	if (dialog.open() != Window.OK) {
		return null;
	}

	try {
		bookmarksService.deleteBookmarks(getAsBookmarkIds(selection), true);
	} catch (BookmarksException e) {
		throw new ExecutionException("Could not delete bookmark", e);
	}
	return null;
}
 
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:21,代码来源:DeleteBookmarkHandler.java

示例7: execute

import org.eclipse.ui.handlers.HandlerUtil; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
	BookmarkFolder parent = null;
	if (selection.isEmpty()) {
		parent = bookmarksService.getBookmarksTree().getRootFolder();
	} else {
		Bookmark bookmark = (Bookmark) selection.getFirstElement();
		if (!(bookmark instanceof BookmarkFolder)) {
			return null;
		}
		parent = (BookmarkFolder) bookmark;
	}
	Shell shell = HandlerUtil.getActiveShell(event);
	String folderName = askBookmarkFolderName(shell);
	if (folderName == null) {
		return null;
	}
	try {
		bookmarksService.addBookmarkFolder(parent.getId(), folderName);
	} catch (BookmarksException e) {
		throw new ExecutionException("Could not add bookmark folder", e);
	}

	return null;
}
 
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:27,代码来源:NewBookmarkFolderHandler.java

示例8: execute

import org.eclipse.ui.handlers.HandlerUtil; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
	Bookmark bookmark = getSelectedBookmark(selection);
	Shell shell = HandlerUtil.getActiveShell(event);
	String newName = askBookmarkName(shell, bookmark.getPropertyValue(Bookmark.PROPERTY_NAME));
	if (newName == null) {
		return null;
	}
	try {
		bookmarksService.renameBookmark(bookmark.getId(), newName);
	} catch (BookmarksException e) {
		throw new ExecutionException("Could not rename bookmark", e);
	}

	return null;

}
 
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:19,代码来源:RenameBookmarkHandler.java

示例9: execute

import org.eclipse.ui.handlers.HandlerUtil; //导入方法依赖的package包/类
public Object execute(final ExecutionEvent event) throws ExecutionException {
	final FilteredItemsSelectionDialog dialog = new TLAFilteredItemsSelectionDialog(HandlerUtil.getActiveShell(event));
	dialog.open();
	
	final Object[] result = dialog.getResult();
	if (result != null && result.length == 1) {
		final Map<String, String> parameters = new HashMap<String, String>();
		if (result[0] instanceof Module && ((Module) result[0]).isRoot()) {
			parameters.put(OpenSpecHandler.PARAM_SPEC, ((Module) result[0]).getModuleName());
			UIHelper.runCommand(OpenSpecHandler.COMMAND_ID, parameters);
		} else if (result[0] instanceof Module) {
			parameters.put(OpenModuleHandler.PARAM_MODULE, ((Module) result[0]).getModuleName());
			UIHelper.runCommand(OpenModuleHandler.COMMAND_ID, parameters);
		} else if (result[0] instanceof Model) {
			parameters.put(OpenModelHandler.PARAM_MODEL_NAME, ((Model) result[0]).getName());
			UIHelper.runCommand(OpenModelHandler.COMMAND_ID, parameters);
		} else if (result[0] instanceof Spec) {
			parameters.put(OpenSpecHandler.PARAM_SPEC, ((Spec) result[0]).getName());
			UIHelper.runCommand(OpenSpecHandler.COMMAND_ID, parameters);
		}
	}
	return null;
}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:24,代码来源:TLAOpenElementSelectionDialogHandler.java

示例10: execute

import org.eclipse.ui.handlers.HandlerUtil; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	Shell shell = HandlerUtil.getActiveShell(event);
	PreferenceDialog dialog = createPreferenceDialogOn(shell, ExternalLibraryPreferencePage.ID, FILTER_IDS, null);
	if (null != dialog) {
		dialog.open();
	}
	return null;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:10,代码来源:OpenExternalLibraryPreferencePageHandler.java

示例11: execute

import org.eclipse.ui.handlers.HandlerUtil; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) {
    PgDbProject proj = OpenProjectUtils.getProject(event);
    Shell shell = HandlerUtil.getActiveShell(event);
    IPreferenceStore prefStore = Activator.getDefault().getPreferenceStore();
    Log.log(Log.LOG_DEBUG, "Diff wizard about to show"); //$NON-NLS-1$
        
    WizardDialog dialog = new WizardDialog(
            shell, new DiffWizard(proj, prefStore));
    dialog.open();
    return null;
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:13,代码来源:Diff.java

示例12: execute

import org.eclipse.ui.handlers.HandlerUtil; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    Shell shell = HandlerUtil.getActiveShell(event);
    FeedBackDialog dialog = new FeedBackDialog(shell);
    dialog.open();
    return null;
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:8,代码来源:FeedBack.java

示例13: execute

import org.eclipse.ui.handlers.HandlerUtil; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	Shell activeShell = HandlerUtil.getActiveShell(event);

	EGradleRootProjectImportWizard wizard = new EGradleRootProjectImportWizard();
	wizard.setImportMode(RootProjectConfigMode.REIMPORT_PROJECTS);
	wizard.setWindowTitle("Reimport project(s)");
	
	WizardDialog dialog = new WizardDialog(activeShell, wizard);

	
	dialog.open();
	return null;
}
 
开发者ID:de-jcup,项目名称:egradle,代码行数:15,代码来源:ReimportGradleProjectHandler.java

示例14: execute

import org.eclipse.ui.handlers.HandlerUtil; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	Shell activeShell = HandlerUtil.getActiveShell(event);

	IWizard wizard = new EGradleNewProjectWizard();

	WizardDialog dialog = new WizardDialog(activeShell, wizard);

	dialog.open();
	return null;
}
 
开发者ID:de-jcup,项目名称:egradle,代码行数:12,代码来源:NewGradleProjectHandler.java

示例15: execute

import org.eclipse.ui.handlers.HandlerUtil; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    ISelection selection = HandlerUtil.getCurrentSelection(event);
    final Shell shell = HandlerUtil.getActiveShell(event);
    if (selection instanceof IStructuredSelection) {
        Iterator<?> it = ((IStructuredSelection) selection).iterator();
        while (it.hasNext()) {
            final Object selected = it.next();
            final Generation generation;
            if (selected instanceof IFile && "genconf".equals(((IFile) selected).getFileExtension())) {
                URI genconfURI = URI.createPlatformResourceURI(((IFile) selected).getFullPath().toString(), true);
                generation = getGeneration(genconfURI);
            } else if (selected instanceof Generation) {
                generation = (Generation) selected;
            } else {
                generation = null;
            }

            if (generation != null) {
                execute(event, generation);
            } else {
                MessageDialog.openError(shell, "Bad selection",
                        "Document generation action can only be triggered on Generation object or a .genconf file.");
            }
        }
    } else {
        MessageDialog.openError(shell, "Bad selection",
                "Document generation action can only be triggered on Generation object or a .genconf file.");
    }

    return null;
}
 
开发者ID:ObeoNetwork,项目名称:M2Doc,代码行数:33,代码来源:AbstractGenerationHandler.java


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