本文整理汇总了Java中org.eclipse.ui.internal.ide.IDEWorkbenchMessages类的典型用法代码示例。如果您正苦于以下问题:Java IDEWorkbenchMessages类的具体用法?Java IDEWorkbenchMessages怎么用?Java IDEWorkbenchMessages使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IDEWorkbenchMessages类属于org.eclipse.ui.internal.ide包,在下文中一共展示了IDEWorkbenchMessages类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resourceExistsInWorkspace
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; //导入依赖的package包/类
/**
* Return true if another project having the same project name exists in
* workspace
*/
private boolean resourceExistsInWorkspace() {
boolean existsInWorkspace = false;
if (!getProjectName().isEmpty()) {
IProject[] projects = IDEWorkbenchPlugin.getPluginWorkspace()
.getRoot().getProjects();
for (int i = 0; i < projects.length && !existsInWorkspace; i++) {
if (getProjectName().toUpperCase().equals(
projects[i].getName().toUpperCase())
&& isMacOrWindowsOS()) {
setErrorMessage(IDEWorkbenchMessages.WizardNewProjectCreationPage_projectExistsMessage);
existsInWorkspace = true;
} else {
if (getProjectName().equals(projects[i].getName())) {
setErrorMessage(IDEWorkbenchMessages.WizardNewProjectCreationPage_projectExistsMessage);
return true;
}
}
}
}
return existsInWorkspace;
}
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:26,代码来源:NewGemocModelingProjectCreationWizardPage.java
示例2: handleAdvancedButtonSelect
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; //导入依赖的package包/类
/**
* Shows/hides the advanced option widgets.
*/
protected void handleAdvancedButtonSelect() {
Shell shell = getShell();
Point shellSize = shell.getSize();
Composite composite = (Composite) getControl();
if (linkedResourceComposite != null) {
linkedResourceComposite.dispose();
linkedResourceComposite = null;
composite.layout();
shell.setSize(shellSize.x, shellSize.y - linkedResourceGroupHeight);
advancedButton.setText(IDEWorkbenchMessages.showAdvanced);
} else {
linkedResourceComposite = linkedResourceGroup
.createContents(linkedResourceParent);
setupLinkedResourceTarget();
if (linkedResourceGroupHeight == -1) {
Point groupSize = linkedResourceComposite.computeSize(
SWT.DEFAULT, SWT.DEFAULT, true);
linkedResourceGroupHeight = groupSize.y;
}
shell.setSize(shellSize.x, shellSize.y + linkedResourceGroupHeight);
composite.layout();
advancedButton.setText(IDEWorkbenchMessages.hideAdvanced);
}
}
示例3: validateFullResourcePath
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; //导入依赖的package包/类
/**
* Returns a <code>boolean</code> indicating whether the specified resource
* path represents a valid new resource in the workbench. An error message
* is stored for future reference if the path does not represent a valid new
* resource path.
*
* @param resourcePath
* the path to validate
* @return <code>boolean</code> indicating validity of the resource path
*/
protected boolean validateFullResourcePath(IPath resourcePath) {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IStatus result = workspace.validatePath(resourcePath.toString(), IResource.FOLDER);
if (!result.isOK()) {
problemType = PROBLEM_PATH_INVALID;
problemMessage = result.getMessage();
return false;
}
if (!allowExistingResources
&& (workspace.getRoot().getFolder(resourcePath).exists() || workspace.getRoot()
.getFile(resourcePath)
.exists())) {
problemType = PROBLEM_RESOURCE_EXIST;
problemMessage = NLS.bind(IDEWorkbenchMessages.ResourceGroup_nameExists, getResource());
return false;
}
return true;
}
示例4: validateResourceName
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; //导入依赖的package包/类
/**
* Returns a <code>boolean</code> indicating whether the resource name rep-
* resents a valid resource name in the workbench. An error message is
* stored for future reference if the name does not represent a valid
* resource name.
*
* @return <code>boolean</code> indicating validity of the resource name
*/
protected boolean validateResourceName() {
String resourceName = getResource();
if (resourceName.length() == 0) {
problemType = PROBLEM_RESOURCE_EMPTY;
problemMessage = NLS.bind(IDEWorkbenchMessages.ResourceGroup_emptyName, resourceType);
return false;
}
if (!Path.ROOT.isValidPath(resourceName)) {
problemType = PROBLEM_NAME_INVALID;
problemMessage = NLS.bind(IDEWorkbenchMessages.ResourceGroup_invalidFilename, resourceName);
return false;
}
return true;
}
示例5: createProjectMenu
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; //导入依赖的package包/类
/**
* Creates and returns the Project menu.
*/
private MenuManager createProjectMenu() {
MenuManager menu = new MenuManager(
IDEWorkbenchMessages.Workbench_project,
IWorkbenchActionConstants.M_PROJECT);
menu.add(new Separator(IWorkbenchActionConstants.PROJ_START));
menu.add(getOpenProjectItem());
menu.add(getCloseProjectItem());
menu.add(new GroupMarker(IWorkbenchActionConstants.OPEN_EXT));
menu.add(new Separator());
menu.add(buildAllAction);
menu.add(buildProjectAction);
addWorkingSetBuildActions(menu);
menu.add(cleanAction);
menu.add(toggleAutoBuildAction);
menu.add(new GroupMarker(IWorkbenchActionConstants.BUILD_EXT));
menu.add(new Separator());
menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
menu.add(new GroupMarker(IWorkbenchActionConstants.PROJ_END));
menu.add(new Separator());
menu.add(projectPropertyDialogAction);
return menu;
}
示例6: createWindowMenu
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; //导入依赖的package包/类
/**
* Creates and returns the Window menu.
*/
private MenuManager createWindowMenu() {
MenuManager menu = new MenuManager(
IDEWorkbenchMessages.Workbench_window,
IWorkbenchActionConstants.M_WINDOW);
menu.add(newWindowAction);
menu.add(newEditorAction);
menu.add(new Separator());
addPerspectiveActions(menu);
menu.add(new Separator());
addKeyboardShortcuts(menu);
Separator sep = new Separator(IWorkbenchActionConstants.MB_ADDITIONS);
sep.setVisible(!Util.isMac());
menu.add(sep);
// See the comment for quit in createFileMenu
ActionContributionItem openPreferencesItem = new ActionContributionItem(
openPreferencesAction);
openPreferencesItem.setVisible(!Util.isMac());
menu.add(openPreferencesItem);
menu.add(ContributionItemFactory.OPEN_WINDOWS.create(getWindow()));
return menu;
}
示例7: addPerspectiveActions
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; //导入依赖的package包/类
/**
* Adds the perspective actions to the specified menu.
*/
private void addPerspectiveActions(MenuManager menu) {
{
String openText = IDEWorkbenchMessages.Workbench_openPerspective;
MenuManager changePerspMenuMgr = new MenuManager(openText,
"openPerspective"); //$NON-NLS-1$
IContributionItem changePerspMenuItem = ContributionItemFactory.PERSPECTIVES_SHORTLIST
.create(getWindow());
changePerspMenuMgr.add(changePerspMenuItem);
menu.add(changePerspMenuMgr);
}
{
MenuManager showViewMenuMgr = new MenuManager(
IDEWorkbenchMessages.Workbench_showView, "showView"); //$NON-NLS-1$
IContributionItem showViewMenu = ContributionItemFactory.VIEWS_SHORTLIST
.create(getWindow());
showViewMenuMgr.add(showViewMenu);
menu.add(showViewMenuMgr);
}
menu.add(new Separator());
menu.add(editActionSetAction);
menu.add(savePerspectiveAction);
menu.add(resetPerspectiveAction);
menu.add(closePerspAction);
menu.add(closeAllPerspsAction);
}
示例8: addKeyboardShortcuts
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; //导入依赖的package包/类
/**
* Adds the keyboard navigation submenu to the specified menu.
*/
private void addKeyboardShortcuts(MenuManager menu) {
MenuManager subMenu = new MenuManager(
IDEWorkbenchMessages.Workbench_shortcuts, "shortcuts"); //$NON-NLS-1$
menu.add(subMenu);
subMenu.add(showPartPaneMenuAction);
subMenu.add(showViewMenuAction);
subMenu.add(quickAccessAction);
subMenu.add(new Separator());
subMenu.add(maximizePartAction);
subMenu.add(minimizePartAction);
subMenu.add(new Separator());
subMenu.add(activateEditorAction);
subMenu.add(nextEditorAction);
subMenu.add(prevEditorAction);
subMenu.add(switchToEditorAction);
subMenu.add(new Separator());
subMenu.add(nextPartAction);
subMenu.add(prevPartAction);
subMenu.add(new Separator());
subMenu.add(nextPerspectiveAction);
subMenu.add(prevPerspectiveAction);
}
示例9: createEditMenu
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; //导入依赖的package包/类
/**
* Creates and returns the Edit menu.
*/
private MenuManager createEditMenu() {
final MenuManager menu = new MenuManager(IDEWorkbenchMessages.Workbench_edit, IWorkbenchActionConstants.M_EDIT);
menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_START));
menu.add(undoAction);
menu.add(redoAction);
menu.add(new GroupMarker(IWorkbenchActionConstants.UNDO_EXT));
menu.add(new Separator());
menu.add(getCutItem());
menu.add(getCopyItem());
menu.add(getPasteItem());
menu.add(new GroupMarker(IWorkbenchActionConstants.CUT_EXT));
menu.add(new Separator());
menu.add(getDeleteItem());
menu.add(getSelectAllItem());
menu.add(new Separator());
menu.add(getFindItem());
menu.add(new GroupMarker(IWorkbenchActionConstants.FIND_EXT));
menu.add(new Separator());
menu.add(new GroupMarker(IWorkbenchActionConstants.ADD_EXT));
menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_END));
menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
return menu;
}
示例10: createHelpMenu
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; //导入依赖的package包/类
/**
* Creates and returns the Help menu.
*/
private MenuManager createHelpMenu() {
final MenuManager menu = new MenuManager(IDEWorkbenchMessages.Workbench_help, IWorkbenchActionConstants.M_HELP);
addSeparatorOrGroupMarker(menu, "group.intro"); //$NON-NLS-1$
menu.add(new GroupMarker("group.intro.ext")); //$NON-NLS-1$
addSeparatorOrGroupMarker(menu, "group.main"); //$NON-NLS-1$
menu.add(helpContentsAction);
addSeparatorOrGroupMarker(menu, "group.assist"); //$NON-NLS-1$
menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_START));
menu.add(new GroupMarker("group.main.ext")); //$NON-NLS-1$
addSeparatorOrGroupMarker(menu, "group.tutorials"); //$NON-NLS-1$
addSeparatorOrGroupMarker(menu, "group.tools"); //$NON-NLS-1$
addSeparatorOrGroupMarker(menu, "group.updates"); //$NON-NLS-1$
menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_END));
addSeparatorOrGroupMarker(menu, IWorkbenchActionConstants.MB_ADDITIONS);
// about should always be at the bottom
menu.add(new Separator("group.about")); //$NON-NLS-1$
final ActionContributionItem aboutItem = new ActionContributionItem(aboutAction);
aboutItem.setVisible(!Util.isMac());
menu.add(aboutItem);
menu.add(new GroupMarker("group.about.ext")); //$NON-NLS-1$
menu.add(openPreferencesAction);
return menu;
}
示例11: checkLocationDeleted
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; //导入依赖的package包/类
void checkLocationDeleted(final IProject project) throws CoreException {
if (!project.exists()) { return; }
final IFileInfo location = IDEResourceInfoUtils.getFileInfo(project.getLocationURI());
if (!location.exists()) {
final String message = NLS.bind(IDEWorkbenchMessages.RefreshAction_locationDeletedMessage,
project.getName(), location.toString());
final MessageDialog dialog = new MessageDialog(WorkbenchHelper.getShell(),
IDEWorkbenchMessages.RefreshAction_dialogTitle, null, message, MessageDialog.QUESTION,
new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0) {
@Override
protected int getShellStyle() {
return super.getShellStyle() | SWT.SHEET;
}
};
WorkbenchHelper.run(() -> dialog.open());
// Do the deletion back in the operation thread
if (dialog.getReturnCode() == 0) { // yes was chosen
project.delete(true, true, null);
}
}
}
示例12: confirmDeleteNonProjects
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; //导入依赖的package包/类
/**
* Asks the user to confirm a delete operation, where the selection contains no projects.
*
* @param resources
* the selected resources
* @return <code>true</code> if the user says to go ahead, and <code>false</code> if the deletion should be
* abandoned
*/
private boolean confirmDeleteNonProjects(final List<? extends IResource> resources) {
String title;
String msg;
if (resources.size() == 1) {
title = IDEWorkbenchMessages.DeleteResourceAction_title1;
final IResource resource = resources.get(0);
if (resource.isLinked()) {
msg = NLS.bind(IDEWorkbenchMessages.DeleteResourceAction_confirmLinkedResource1, resource.getName());
} else {
msg = NLS.bind(IDEWorkbenchMessages.DeleteResourceAction_confirm1, resource.getName());
}
} else {
title = IDEWorkbenchMessages.DeleteResourceAction_titleN;
if (containsLinkedResource(resources)) {
msg = NLS.bind(IDEWorkbenchMessages.DeleteResourceAction_confirmLinkedResourceN,
Integer.valueOf(resources.size()));
} else {
msg = NLS.bind(IDEWorkbenchMessages.DeleteResourceAction_confirmN, new Integer(resources.size()));
}
}
return MessageDialog.openQuestion(shellProvider.getShell(), title, msg);
}
示例13: closeMatchingEditors
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; //导入依赖的package包/类
/**
* Tries to find opened editors matching given resource roots. The editors will be closed without confirmation and
* only if the editor resource does not exists anymore.
*
* @param resourceRoots
* non null array with deleted resource tree roots
* @param deletedOnly
* true to close only editors on resources which do not exist
*/
static void closeMatchingEditors(final List<? extends IResource> resourceRoots, final boolean deletedOnly) {
if (resourceRoots.isEmpty()) { return; }
final Runnable runnable = () -> SafeRunner.run(new SafeRunnable(IDEWorkbenchMessages.ErrorOnCloseEditors) {
@Override
public void run() {
final IWorkbenchWindow w = getActiveWindow();
if (w != null) {
final List<IEditorReference> toClose = getMatchingEditors(resourceRoots, w, deletedOnly);
if (toClose.isEmpty()) { return; }
closeEditors(toClose, w);
}
}
});
BusyIndicator.showWhile(PlatformUI.getWorkbench().getDisplay(), runnable);
}
示例14: checkLocationDeleted
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; //导入依赖的package包/类
/**
* Checks whether the given project's location has been deleted. If so, prompts the user with whether to delete the
* project or not.
*/
void checkLocationDeleted(final IProject project) throws CoreException {
if (!project.exists()) { return; }
final IFileInfo location = IDEResourceInfoUtils.getFileInfo(project.getLocationURI());
if (!location.exists()) {
final String message = NLS.bind(IDEWorkbenchMessages.RefreshAction_locationDeletedMessage,
project.getName(), location.toString());
final MessageDialog dialog = new MessageDialog(WorkbenchHelper.getShell(),
IDEWorkbenchMessages.RefreshAction_dialogTitle, null, message, MessageDialog.QUESTION,
new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0) {
@Override
protected int getShellStyle() {
return super.getShellStyle() | SWT.SHEET;
}
};
WorkbenchHelper.run(() -> dialog.open());
// Do the deletion back in the operation thread
if (dialog.getReturnCode() == 0) { // yes was chosen
project.delete(true, true, null);
}
}
}
示例15: queryNewResourceName
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; //导入依赖的package包/类
/**
* Return the new name to be given to the target resource.
*
* @return java.lang.String
* @param resource
* the resource to query status on
*/
protected String queryNewResourceName(final IResource resource) {
final IWorkspace workspace = IDEWorkbenchPlugin.getPluginWorkspace();
final IPath prefix = resource.getFullPath().removeLastSegments(1);
final IInputValidator validator = string -> {
if (resource.getName()
.equals(string)) { return IDEWorkbenchMessages.RenameResourceAction_nameMustBeDifferent; }
final IStatus status = workspace.validateName(string, resource.getType());
if (!status.isOK()) { return status.getMessage(); }
if (workspace.getRoot()
.exists(prefix.append(string))) { return IDEWorkbenchMessages.RenameResourceAction_nameExists; }
return null;
};
final InputDialog dialog =
new InputDialog(WorkbenchHelper.getShell(), IDEWorkbenchMessages.RenameResourceAction_inputDialogTitle,
IDEWorkbenchMessages.RenameResourceAction_inputDialogMessage, resource.getName(), validator);
dialog.setBlockOnOpen(true);
final int result = dialog.open();
if (result == Window.OK)
return dialog.getValue();
return null;
}