本文整理汇总了Java中org.eclipse.ui.PlatformUI类的典型用法代码示例。如果您正苦于以下问题:Java PlatformUI类的具体用法?Java PlatformUI怎么用?Java PlatformUI使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PlatformUI类属于org.eclipse.ui包,在下文中一共展示了PlatformUI类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: chooseGW4EProject
import org.eclipse.ui.PlatformUI; //导入依赖的package包/类
public static IJavaProject chooseGW4EProject(IJavaProject javaProject) {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
IJavaProject[] projects = getGW4EProjects();
ILabelProvider labelProvider = new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT);
ElementListSelectionDialog dialog = new ElementListSelectionDialog(shell, labelProvider);
dialog.setTitle(MessageUtil.getString("projectdialog_title"));
dialog.setMessage(MessageUtil.getString("projectdialog_message"));
dialog.setElements(projects);
if (javaProject != null) {
dialog.setInitialSelections(new Object[] { javaProject });
}
if (dialog.open() == Window.OK) {
return (IJavaProject) dialog.getFirstResult();
}
return null;
}
示例2: getInitialLocation
import org.eclipse.ui.PlatformUI; //导入依赖的package包/类
/**
* Returns the initial location to use for the shell. The default implementation centers the shell horizontally (1/2
* of the difference to the left and 1/2 to the right) and vertically (1/3 above and 2/3 below) relative to the
* active workbench windows shell, or display bounds if there is no parent shell.
*
* @param shell
* the shell which initial location has to be calculated.
* @param initialSize
* the initial size of the shell, as returned by <code>getInitialSize</code>.
* @return the initial location of the shell
*/
public static Point getInitialLocation(final Shell shell, final Point initialSize) {
final Composite parent = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
Monitor monitor = shell.getDisplay().getPrimaryMonitor();
if (parent != null) {
monitor = parent.getMonitor();
}
final Rectangle monitorBounds = monitor.getClientArea();
Point centerPoint;
if (parent != null) {
centerPoint = Geometry.centerPoint(parent.getBounds());
} else {
centerPoint = Geometry.centerPoint(monitorBounds);
}
return new Point(centerPoint.x - (initialSize.x / 2), Math.max(
monitorBounds.y, Math.min(centerPoint.y
- (initialSize.y * 2 / 3), monitorBounds.y
+ monitorBounds.height - initialSize.y)));
}
示例3: execute
import org.eclipse.ui.PlatformUI; //导入依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(ID);
if (descriptor == null) {
descriptor = PlatformUI.getWorkbench().getImportWizardRegistry().findWizard(ID);
}
if (descriptor == null) {
descriptor = PlatformUI.getWorkbench().getExportWizardRegistry().findWizard(ID);
}
try {
if (descriptor != null) {
IWizard wizard = descriptor.createWizard();
WizardDialog wd = new WizardDialog(Display.getDefault().getActiveShell(), wizard);
wd.setTitle(wizard.getWindowTitle());
wd.open();
}
} catch (CoreException e) {
e.printStackTrace();
}
return null;
}
示例4: performFinish
import org.eclipse.ui.PlatformUI; //导入依赖的package包/类
@Override
public boolean performFinish()
{
boolean res = super.performFinish();
if( res )
{
final IJavaElement newElement = getCreatedElement();
IWorkingSet[] workingSets = fFirstPage.getWorkingSets();
if( workingSets.length > 0 )
{
PlatformUI.getWorkbench().getWorkingSetManager().addToWorkingSets(newElement, workingSets);
}
BasicNewResourceWizard.selectAndReveal(fSecondPage.getJavaProject().getProject(), getWorkbench()
.getActiveWorkbenchWindow());
}
return res;
}
示例5: isEnabled
import org.eclipse.ui.PlatformUI; //导入依赖的package包/类
@Override
public boolean isEnabled() {
ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
if(selection instanceof IStructuredSelection) {
IStructuredSelection s = (IStructuredSelection) selection;
if(s.size() == 1) {
Object e = s.getFirstElement();
try {
return e instanceof IProject && ((IProject) e).hasNature("org.eclipse.jdt.internal.core.JavaProject");
} catch (CoreException e1) {
return false;
}
}
}
return false;
}
示例6: execute
import org.eclipse.ui.PlatformUI; //导入依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
TreeSelection selection = (TreeSelection) HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getSelection();
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
Object firstElement = selection.getFirstElement();
if (firstElement instanceof IAdaptable)
{
IFile file = (IFile)((IAdaptable)firstElement).getAdapter(IFile.class);
IPath path = file.getLocation();
try {
//TODO fix
SurveyGenerator.generateAll(path.toOSString(), path.toOSString());
MessageDialog.openInformation(shell, "Success", "Code was generated successfully");
} catch (Exception e) {
//MessageDialog.openError(shell, "Error", e.getMessage());
e.printStackTrace();
}
}
return null;
}
示例7: open
import org.eclipse.ui.PlatformUI; //导入依赖的package包/类
public static void open(String modelPath, ModelData[] additionalModels, String generatorstopcondition,
String startnode, boolean removeBlockedElements, boolean omitEgdeswithoutDescription) {
try {
Display.getDefault().asyncExec(() -> {
RunAsManualWizard wizard = new RunAsManualWizard(modelPath, additionalModels, generatorstopcondition,
startnode, removeBlockedElements, omitEgdeswithoutDescription);
wizard.init(PlatformUI.getWorkbench(), (IStructuredSelection) null);
Shell activeShell = Display.getDefault().getActiveShell();
if (activeShell == null)
return;
WizardDialog dialog = new WizardDialog(activeShell, wizard);
dialog.open();
});
} catch (Exception e) {
ResourceManager.logException(e);
}
}
示例8: notifyDbChanged
import org.eclipse.ui.PlatformUI; //导入依赖的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));
}
}
}
}
}
示例9: mouseUp
import org.eclipse.ui.PlatformUI; //导入依赖的package包/类
@Override
public void mouseUp(MouseEvent e) {
if (e.getSource() instanceof Button) {
Button sel = (Button) e.getSource();
if (sel.getText().equalsIgnoreCase("Save")) {
try {
String tempText = util.processAdd(isEdit, editName, comp, type, editor.getDocumentProvider().getDocument(getEditorInput()).get());
editor.getDocumentProvider().getDocument(getEditorInput()).set(tempText);
createPage1();
setActivePage(1);
} catch (JAXBException ex) {
ErrorDialog.openError(getSite().getShell(), "Error removing item", null, new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, 0, "Error removing item", null));
}
}
}
}
示例10: getReplacementText
import org.eclipse.ui.PlatformUI; //导入依赖的package包/类
@Override
public String getReplacementText() {
SelectAnyIProjectDialog dialog = new SelectAnyIProjectDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
if (dialog.open() == Dialog.OK) {
Object[] selections = dialog.getResult();
if(selections != null
&& selections.length != 0
&& selections[0] instanceof IProject
){
dsaProject = (IProject) selections[0];
Set<String> aspects = SequentialSingleLanguageTemplate.getAspectClassesList(dsaProject);
final StringBuilder insertion = new StringBuilder();
for (String asp : aspects) {
insertion.append("\twith " + asp + "\n");
}
insertion.replace(0, 1, "");//remove the first \t
return insertion.toString();
}
}
return "";
}
示例11: execute
import org.eclipse.ui.PlatformUI; //导入依赖的package包/类
/**
* {@inheritDoc}
*
* @see org.eclipse.sirius.tools.api.ui.IExternalJavaAction#execute(java.util.Collection, java.util.Map)
*/
public void execute(Collection<? extends EObject> selections, Map<String, Object> parameters) {
final ILaunchConfigurationType launchConfigType = DebugPlugin.getDefault().getLaunchManager()
.getLaunchConfigurationType(getLaunchConfigurationTypeID());
Set<String> modes = new HashSet<String>();
modes.add("debug");
try {
ILaunchDelegate[] delegates = launchConfigType.getDelegates(modes);
if (delegates.length != 0
&& delegates[0].getDelegate() instanceof AbstractDSLLaunchConfigurationDelegateUI) {
AbstractDSLLaunchConfigurationDelegateUI delegate = (AbstractDSLLaunchConfigurationDelegateUI)delegates[0]
.getDelegate();
delegate.launch(delegate.getLaunchableResource(PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage().getActiveEditor()),
getFirstInstruction(selections), "debug");
}
} catch (CoreException e) {
DebugSiriusIdeUiPlugin.getPlugin().getLog().log(
new Status(IStatus.ERROR, DebugSiriusIdeUiPlugin.ID, e.getLocalizedMessage(), e));
}
}
示例12: showQueue
import org.eclipse.ui.PlatformUI; //导入依赖的package包/类
private void showQueue() throws Exception {
IViewReference[] refs = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getViewReferences();
boolean foundStatus = false;
for (IViewReference vr : refs) {
if (StatusQueueView.ID.equals(vr.getId())) foundStatus = true;
}
if (!foundStatus) {
String secondId = XcenServices.getQueueViewSecondaryId();
IViewPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(StatusQueueView.ID+":"+secondId, null, IWorkbenchPage.VIEW_VISIBLE);
if (part !=null && part instanceof StatusQueueView) {
StatusQueueView view = (StatusQueueView)part;
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().bringToTop(view);
view.refresh();
}
}
}
示例13: performHelp
import org.eclipse.ui.PlatformUI; //导入依赖的package包/类
@Override
public void performHelp() {
String href = null;
BeanInfo bi = getCurrentSelectedBeanInfo();
if (bi != null) {
String displayName = bi.getBeanDescriptor().getDisplayName();
if ((displayName != null) && !displayName.equals(""))
href = getBeanHelpHref(displayName);
}
if ((href == null) || href.equals(""))
href = "convertigoObjects.html";
String helpPageUri = "/com.twinsoft.convertigo.studio.help/help/helpRefManual/"+ href;
PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(helpPageUri);
}
示例14: loadProperties
import org.eclipse.ui.PlatformUI; //导入依赖的package包/类
/**
*
* loading the properties files
*/
public void loadProperties() {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
if (page.getActiveEditor().getEditorInput() instanceof IFileEditorInput) {
IFileEditorInput input = (IFileEditorInput) page.getActiveEditor().getEditorInput();
List<File> paramNameList = null;
IFile file = input.getFile();
IProject activeProject = file.getProject();
final File globalparamFilesPath = new File(activeProject.getLocation().toString() + "/" + "globalparam");
final File localParamFilePath = new File(activeProject.getLocation().toString() + "/" + Constants.PARAM_FOLDER);
File[] files = (File[]) ArrayUtils.addAll(listFilesForFolder(globalparamFilesPath),
getJobsPropertyFile(localParamFilePath,file));
if (files != null) {
paramNameList = Arrays.asList(files);
getParamMap(paramNameList, null);
}
}
}
示例15: closeConnectorEditors
import org.eclipse.ui.PlatformUI; //导入依赖的package包/类
public void closeConnectorEditors(Connector connector) {
IWorkbenchPage activePage = PlatformUI
.getWorkbench()
.getActiveWorkbenchWindow()
.getActivePage();
if (activePage != null) {
if (connector != null) {
IEditorReference[] editorRefs = activePage.getEditorReferences();
for (int i=0;i<editorRefs.length;i++) {
IEditorReference editorRef = (IEditorReference)editorRefs[i];
try {
IEditorInput editorInput = editorRef.getEditorInput();
if ((editorInput != null) && (editorInput instanceof ConnectorEditorInput)) {
if (((ConnectorEditorInput)editorInput).is(connector)) {
activePage.closeEditor(editorRef.getEditor(false),true);
break;
}
}
}
catch(PartInitException e) {
ConvertigoPlugin.logException(e, "Error while retrieving the connector editor '" + editorRef.getName() + "'");
}
}
}
}
}