org.eclipse.ui.PlatformUI#PLUGIN_ID源码实例Demo

下面列出了org.eclipse.ui.PlatformUI#PLUGIN_ID 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: tlaplus   文件: FilteredItemsSelectionDialog.java
public IStatus runInUIThread(IProgressMonitor monitor) {

			if (!progressLabel.isDisposed())
				progressLabel.setText(progressMonitor != null ? progressMonitor
						.getMessage() : EMPTY_STRING);

			if (progressMonitor == null || progressMonitor.isDone()) {
				return new Status(IStatus.CANCEL, PlatformUI.PLUGIN_ID,
						IStatus.CANCEL, EMPTY_STRING, null);
			}

			// Schedule cyclical with 500 milliseconds delay
			schedule(500);

			return new Status(IStatus.OK, PlatformUI.PLUGIN_ID, IStatus.OK,
					EMPTY_STRING, null);
		}
 
源代码2 项目: tlaplus   文件: FilteredItemsSelectionDialog.java
protected IStatus run(IProgressMonitor monitor) {
	if (monitor.isCanceled()) {
		return new Status(IStatus.CANCEL, WorkbenchPlugin.PI_WORKBENCH,
				IStatus.CANCEL, EMPTY_STRING, null);
	}

	if (FilteredItemsSelectionDialog.this != null) {
		GranualProgressMonitor wrappedMonitor = new GranualProgressMonitor(
				monitor);
		FilteredItemsSelectionDialog.this.reloadCache(true,
				wrappedMonitor);
	}

	if (!monitor.isCanceled()) {
		refreshJob.schedule();
	}

	return new Status(IStatus.OK, PlatformUI.PLUGIN_ID, IStatus.OK,
			EMPTY_STRING, null);

}
 
源代码3 项目: tlaplus   文件: TraceExpressionModelWriter.java
/**
    * Write the content to files
    * @param tlaFile
    * @param cfgFile
    * @param monitor
    * @throws CoreException
    */
public void writeFiles(final IFile tlaFile, final IFile cfgFile, final IProgressMonitor monitor) throws CoreException {
	final ContentWriter cw = (inputStream, forTLAFile) -> {
		final IFile file = forTLAFile ? tlaFile : cfgFile;
		
		if (file.exists()) {
			try {
				file.setContents(inputStream, IResource.FORCE, monitor);
			} catch (final CoreException ce) {
				throw new IOException("Exception writing file " + ce.getMessage(), ce);
			}
		} else {
			throw new IOException("Expected file " + file.getName() + " has been removed externally.");
		}
	};
	
	try {
		super.writeFiles(cw);
	} catch (final IOException e) {
		throw new CoreException(new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.ERROR,
								"Exception encountered attempting to write modules for the model checking.", e));
	}
   }
 
源代码4 项目: tlaplus   文件: ModelWriter.java
/**
    * Write the content to files
    * @param tlaFile
    * @param cfgFile
    * @param monitor
    * @throws CoreException
    */
public void writeFiles(final IFile tlaFile, final IFile cfgFile, final IProgressMonitor monitor) throws CoreException {
	final ContentWriter cw = (inputStream, forTLAFile) -> {
		final IFile file = forTLAFile ? tlaFile : cfgFile;
		
		if (file.exists()) {
			try {
				file.setContents(inputStream, IResource.FORCE, monitor);
			} catch (final CoreException ce) {
				throw new IOException("Exception writing file " + ce.getMessage(), ce);
			}
		} else {
			throw new IOException("Expected file " + file.getName() + " has been removed externally.");
		}
	};
	
	try {
		super.writeFiles(cw);
	} catch (final IOException e) {
		throw new CoreException(new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.ERROR,
								"Exception encountered attempting to write modules for the model checking.", e));
	}
   }
 
源代码5 项目: gama   文件: NavigatorResourceDropAssistant.java
/**
 * Performs a drop using the FileTransfer transfer type.
 */
private IStatus performFileDrop(final CommonDropAdapter anAdapter, final Object data) {
	final int currentOperation = anAdapter.getCurrentOperation();
	final MultiStatus problems =
			new MultiStatus(PlatformUI.PLUGIN_ID, 0, WorkbenchNavigatorMessages.DropAdapter_problemImporting, null);
	mergeStatus(problems,
			validateTarget(anAdapter.getCurrentTarget(), anAdapter.getCurrentTransfer(), currentOperation));

	final IContainer target = getActualTarget(ResourceManager.getResource(anAdapter.getCurrentTarget()));
	final String[] names = (String[]) data;
	// Run the import operation asynchronously.
	// Otherwise the drag source (e.g., Windows Explorer) will be blocked
	// while the operation executes. Fixes bug 16478.
	Display.getCurrent().asyncExec(() -> {
		getShell().forceActive();
		new CopyFilesAndFoldersOperation(getShell()).copyOrLinkFiles(names, target, currentOperation);
	});
	return problems;
}
 
/**
 * Performs a drop using the FileTransfer transfer type.
 */
private IStatus performFileDrop(final CommonDropAdapter anAdapter, Object data) {
	final int currentOperation = anAdapter.getCurrentOperation();
	MultiStatus problems = new MultiStatus(PlatformUI.PLUGIN_ID, 0,
			WorkbenchNavigatorMessages.resources_ResourceDropAdapterAssistant_problemImporting, null);
	mergeStatus(problems,
			validateTarget(anAdapter.getCurrentTarget(), anAdapter
					.getCurrentTransfer(), currentOperation));

	final IContainer target = getActualTarget((IResource) anAdapter
			.getCurrentTarget());
	final String[] names = (String[]) data;
	// Run the import operation asynchronously.
	// Otherwise the drag source (e.g., Windows Explorer) will be blocked
	// while the operation executes. Fixes bug 16478.
	Display.getCurrent().asyncExec(new Runnable() {
		public void run() {
			getShell().forceActive();
			new CopyFilesAndFoldersOperation(getShell()).copyOrLinkFiles(names, target, currentOperation);
		}
	});
	return problems;
}
 
源代码7 项目: Pydev   文件: PyResourceDropAdapterAssistant.java
/**
 * Performs a drop using the FileTransfer transfer type.
 */
private IStatus performFileDrop(CommonDropAdapter anAdapter, Object data) {
    data = getActual(data);
    MultiStatus problems = new MultiStatus(PlatformUI.PLUGIN_ID, 0,
            WorkbenchNavigatorMessages.DropAdapter_problemImporting, null);
    mergeStatus(
            problems,
            validateTarget(getCurrentTarget(anAdapter), anAdapter.getCurrentTransfer(),
                    anAdapter.getCurrentOperation()));

    final IContainer target = getActualTarget((IResource) getCurrentTarget(anAdapter));
    final String[] names = (String[]) data;
    // Run the import operation asynchronously.
    // Otherwise the drag source (e.g., Windows Explorer) will be blocked
    // while the operation executes. Fixes bug 16478.
    Display.getCurrent().asyncExec(new Runnable() {
        @Override
        public void run() {
            getShell().forceActive();
            CopyFilesAndFoldersOperation operation = new CopyFilesAndFoldersOperation(getShell());
            operation.copyFiles(names, target);
        }
    });
    return problems;
}
 
源代码8 项目: tmxeditor8   文件: ResourceDropAdapterAssistant.java
/**
 * Performs a drop using the FileTransfer transfer type.
 */
private IStatus performFileDrop(final CommonDropAdapter anAdapter, Object data) {
	final int currentOperation = anAdapter.getCurrentOperation();
	MultiStatus problems = new MultiStatus(PlatformUI.PLUGIN_ID, 0,
			WorkbenchNavigatorMessages.resources_ResourceDropAdapterAssistant_problemImporting, null);
	mergeStatus(problems,
			validateTarget(anAdapter.getCurrentTarget(), anAdapter
					.getCurrentTransfer(), currentOperation));

	final IContainer target = getActualTarget((IResource) anAdapter
			.getCurrentTarget());
	final String[] names = (String[]) data;
	// Run the import operation asynchronously.
	// Otherwise the drag source (e.g., Windows Explorer) will be blocked
	// while the operation executes. Fixes bug 16478.
	Display.getCurrent().asyncExec(new Runnable() {
		public void run() {
			getShell().forceActive();
			new CopyFilesAndFoldersOperation(getShell()).copyOrLinkFiles(names, target, currentOperation);
		}
	});
	return problems;
}
 
源代码9 项目: Pydev   文件: PyResourceDropAdapterAssistant.java
/**
 * Performs a resource copy
 */
private IStatus performResourceCopy(CommonDropAdapter dropAdapter, Shell shell, IResource[] sources) {
    MultiStatus problems = new MultiStatus(PlatformUI.PLUGIN_ID, 1,
            WorkbenchNavigatorMessages.DropAdapter_problemsMoving, null);
    mergeStatus(
            problems,
            validateTarget(getCurrentTarget(dropAdapter), dropAdapter.getCurrentTransfer(),
                    dropAdapter.getCurrentOperation()));

    IContainer target = getActualTarget((IResource) getCurrentTarget(dropAdapter));
    CopyFilesAndFoldersOperation operation = new CopyFilesAndFoldersOperation(shell);
    IResource[] copiedResources = operation.copyResources(sources, target);
    if (copiedResources.length > 0) {
        PythonPathHelper.updatePyPath(copiedResources, target, PythonPathHelper.OPERATION_COPY);
    }

    return problems;
}
 
源代码10 项目: Pydev   文件: CopyFilesAndFoldersOperation.java
/**
 * Checks whether the infos exist.
 *
 * @param stores
 *            the file infos to test
 * @return Multi status with one error message for each missing file.
 */
IStatus checkExist(IFileStore[] stores) {
    MultiStatus multiStatus = new MultiStatus(PlatformUI.PLUGIN_ID, IStatus.OK, getProblemsMessage(), null);

    for (int i = 0; i < stores.length; i++) {
        if (stores[i].fetchInfo().exists() == false) {
            String message = NLS.bind(IDEWorkbenchMessages.CopyFilesAndFoldersOperation_resourceDeleted,
                    stores[i].getName());
            IStatus status = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.OK, message, null);
            multiStatus.add(status);
        }
    }
    return multiStatus;
}
 
源代码11 项目: tlaplus   文件: FilteredItemsSelectionDialog.java
/**
 * Executes job using the given filtering progress monitor. A hook for
 * subclasses.
 *
 * @param monitor
 *            progress monitor
 * @return result of the execution
 */
protected IStatus doRun(GranualProgressMonitor monitor) {
	try {
		internalRun(monitor);
	} catch (CoreException e) {
		cancel();
		return new Status(
				IStatus.ERROR,
				PlatformUI.PLUGIN_ID,
				IStatus.ERROR,
				WorkbenchMessages.FilteredItemsSelectionDialog_jobError,
				e);
	}
	return Status.OK_STATUS;
}
 
源代码12 项目: gama   文件: RenameResourceAction.java
@Override
protected IRunnableWithProgress createOperation(final IStatus[] errorStatus) {
	return monitor -> {
		final IResource[] resources = getActionResources().toArray(new IResource[getActionResources().size()]);
		// Rename is only valid for a single resource. This has already
		// been validated.
		if (resources.length == 1) {
			// check for overwrite
			final IWorkspaceRoot workspaceRoot = resources[0].getWorkspace().getRoot();
			final IResource newResource = workspaceRoot.findMember(newPath);
			boolean go = true;
			if (newResource != null) {
				go = checkOverwrite(WorkbenchHelper.getShell(), newResource);
			}
			if (go) {
				final MoveResourcesOperation op = new MoveResourcesOperation(resources[0], newPath,
						IDEWorkbenchMessages.RenameResourceAction_operationTitle);
				op.setModelProviderIds(getModelProviderIds());
				try {
					PlatformUI.getWorkbench().getOperationSupport().getOperationHistory().execute(op, monitor,
							WorkspaceUndoUtil.getUIInfoAdapter(WorkbenchHelper.getShell()));
				} catch (final ExecutionException e) {
					if (e.getCause() instanceof CoreException) {
						errorStatus[0] = ((CoreException) e.getCause()).getStatus();
					} else {
						errorStatus[0] = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, getProblemsMessage(), e);
					}
				}
			}
		}
	};
}
 
源代码13 项目: birt   文件: MongoDBAdvancedSettingsDialog.java
private Status getMiscStatus( int severity, String message )
{
	return new Status( severity,
			PlatformUI.PLUGIN_ID,
			severity,
			message,
			null );
}
 
源代码14 项目: Pydev   文件: CopyFilesAndFoldersOperation.java
/**
 * Checks whether the resources with the given names exist.
 *
 * @param resources
 *            IResources to checl
 * @return Multi status with one error message for each missing file.
 */
IStatus checkExist(IResource[] resources) {
    MultiStatus multiStatus = new MultiStatus(PlatformUI.PLUGIN_ID, IStatus.OK, getProblemsMessage(), null);

    for (int i = 0; i < resources.length; i++) {
        IResource resource = resources[i];
        if (resource != null) {
            URI location = resource.getLocationURI();
            String message = null;
            if (location != null) {
                IFileInfo info = IDEResourceInfoUtils.getFileInfo(location);
                if (info == null || info.exists() == false) {
                    if (resource.isLinked()) {
                        message = NLS.bind(IDEWorkbenchMessages.CopyFilesAndFoldersOperation_missingLinkTarget,
                                resource.getName());
                    } else {
                        message = NLS.bind(IDEWorkbenchMessages.CopyFilesAndFoldersOperation_resourceDeleted,
                                resource.getName());
                    }
                }
            }
            if (message != null) {
                IStatus status = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.OK, message, null);
                multiStatus.add(status);
            }
        }
    }
    return multiStatus;
}
 
源代码15 项目: birt   文件: MethodParameterDialog.java
private Status getMiscStatus( int severity, String message )
{
	return new Status( severity,
			PlatformUI.PLUGIN_ID,
			severity,
			message,
			null );
}
 
源代码16 项目: birt   文件: ColumnMappingDialog.java
private Status getMiscStatus( int severity, String message )
{
	return new Status( severity,
			PlatformUI.PLUGIN_ID,
			severity,
			message,
			null );
}
 
protected IRunnableWithProgress createOperation(final IStatus[] errorStatus) {
	return new IRunnableWithProgress() {
		public void run(IProgressMonitor monitor) {
			IResource[] resources = (IResource[]) getActionResources()
					.toArray(new IResource[getActionResources().size()]);
			// Rename is only valid for a single resource. This has already
			// been validated.
			if (resources.length == 1) {
				// check for overwrite
				IWorkspaceRoot workspaceRoot = resources[0].getWorkspace()
						.getRoot();
				IResource newResource = workspaceRoot.findMember(newPath);
				boolean go = true;
				if (newResource != null) {
					go = checkOverwrite(shellProvider.getShell(), newResource);
				}
				if (go) {
					MoveResourcesOperation op = new MoveResourcesOperation(
							resources[0],
							newPath,
							IDEWorkbenchMessages.RenameResourceAction_operationTitle);
					op.setModelProviderIds(getModelProviderIds());
					try {
						PlatformUI
								.getWorkbench()
								.getOperationSupport()
								.getOperationHistory()
								.execute(
										op,
										monitor,
										WorkspaceUndoUtil
												.getUIInfoAdapter(shellProvider.getShell()));
					} catch (ExecutionException e) {
						if (e.getCause() instanceof CoreException) {
							errorStatus[0] = ((CoreException) e.getCause())
									.getStatus();
						} else {
							errorStatus[0] = new Status(IStatus.ERROR,
									PlatformUI.PLUGIN_ID,
									getProblemsMessage(), e);
						}
					}
				}
			}
		}
	};
}
 
/**
	 * Performs a resource copy
	 */
	private IStatus performResourceCopy(CommonDropAdapter dropAdapter,
			Shell shell, IResource[] sources) {
		MultiStatus problems = new MultiStatus(PlatformUI.PLUGIN_ID, 1,
				WorkbenchNavigatorMessages.resources_ResourceDropAdapterAssistant_problemsMoving, null);
		mergeStatus(problems, validateTarget(dropAdapter.getCurrentTarget(), dropAdapter.getCurrentTransfer(),
				dropAdapter.getCurrentOperation()));

		IContainer target = getActualTarget((IResource) dropAdapter.getCurrentTarget());

		boolean shouldLinkAutomatically = false;
		if (target.isVirtual()) {
			shouldLinkAutomatically = true;
			for (int i = 0; i < sources.length; i++) {
				if ((sources[i].getType() != IResource.FILE) && (sources[i].getLocation() != null)) {
					// If the source is a folder, but the location is null (a
					// broken link, for example),
					// we still generate a link automatically (the best option).
					shouldLinkAutomatically = false;
					break;
				}
			}
		}

		CopyFilesAndFoldersOperation operation = new CopyFilesAndFoldersOperation(shell);
		// if the target is a virtual folder and all sources are files, then
		// automatically create links
		if (shouldLinkAutomatically) {
			operation.setCreateLinks(true);
			operation.copyResources(sources, target);
		} else {
//			boolean allSourceAreLinksOrVirtualFolders = true;
//			for (int i = 0; i < sources.length; i++) {
//				if (!sources[i].isVirtual() && !sources[i].isLinked()) {
//					allSourceAreLinksOrVirtualFolders = false;
//					break;
//				}
//			}
//			// if all sources are either links or groups, copy then normally,
//			// don't show the dialog
//			if (!allSourceAreLinksOrVirtualFolders) {
//				IPreferenceStore store= IDEWorkbenchPlugin.getDefault().getPreferenceStore();
//				String dndPreference= store.getString(target.isVirtual() ? IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_VIRTUAL_FOLDER_MODE : IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_MODE);
//
//				if (dndPreference.equals(IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_MODE_PROMPT)) {
//					ImportTypeDialog dialog = new ImportTypeDialog(getShell(), dropAdapter.getCurrentOperation(), sources, target);
//					dialog.setResource(target);
//					if (dialog.open() == Window.OK) {
//						if (dialog.getSelection() == ImportTypeDialog.IMPORT_VIRTUAL_FOLDERS_AND_LINKS)
//							operation.setVirtualFolders(true);
//						if (dialog.getSelection() == ImportTypeDialog.IMPORT_LINK)
//							operation.setCreateLinks(true);
//						if (dialog.getVariable() != null)
//							operation.setRelativeVariable(dialog.getVariable());
//						operation.copyResources(sources, target);
//					} else
//						return problems;
//				}
//				else
//					operation.copyResources(sources, target);
//			} else
				operation.copyResources(sources, target);
		}

		return problems;
	}
 
protected IRunnableWithProgress createOperation(final IStatus[] errorStatus) {
	return new IRunnableWithProgress() {
		public void run(IProgressMonitor monitor) {
			IResource[] resources = (IResource[]) getActionResources()
					.toArray(new IResource[getActionResources().size()]);
			// Rename is only valid for a single resource. This has already
			// been validated.
			if (resources.length == 1) {
				// check for overwrite
				IWorkspaceRoot workspaceRoot = resources[0].getWorkspace()
						.getRoot();
				IResource newResource = workspaceRoot.findMember(newPath);
				boolean go = true;
				if (newResource != null) {
					go = checkOverwrite(shellProvider.getShell(), newResource);
				}
				if (go) {
					MoveResourcesOperation op = new MoveResourcesOperation(
							resources[0],
							newPath,
							IDEWorkbenchMessages.RenameResourceAction_operationTitle);
					op.setModelProviderIds(getModelProviderIds());
					try {
						PlatformUI
								.getWorkbench()
								.getOperationSupport()
								.getOperationHistory()
								.execute(
										op,
										monitor,
										WorkspaceUndoUtil
												.getUIInfoAdapter(shellProvider.getShell()));
					} catch (ExecutionException e) {
						if (e.getCause() instanceof CoreException) {
							errorStatus[0] = ((CoreException) e.getCause())
									.getStatus();
						} else {
							errorStatus[0] = new Status(IStatus.ERROR,
									PlatformUI.PLUGIN_ID,
									getProblemsMessage(), e);
						}
					}
				}
			}
		}
	};
}
 
源代码20 项目: birt   文件: ExportDataSourceDialog.java
/**
 * 
 * @param severity
 * @param message
 * @return
 */
protected Status getMiscStatus( int severity, String message )
{
	return new Status( severity, PlatformUI.PLUGIN_ID, severity, message, null );
}