Java 类org.eclipse.ui.internal.ide.IDEWorkbenchMessages 实例源码

项目:gemoc-studio-modeldebugging    文件:NewGemocModelingProjectCreationWizardPage.java   
/**
 * 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;
}
项目:bdf2    文件:WizardNewFileCreationPage.java   
/**
 * 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);
    }
}
项目:NEXCORE-UML-Modeler    文件:ContainerGroup.java   
/**
 * 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;
}
项目:NEXCORE-UML-Modeler    文件:ContainerGroup.java   
/**
 * 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;
}
项目:PDFReporter-Studio    文件:ApplicationActionBarAdvisor.java   
/**
 * 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;
}
项目:PDFReporter-Studio    文件:ApplicationActionBarAdvisor.java   
/**
 * 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;
}
项目:PDFReporter-Studio    文件:ApplicationActionBarAdvisor.java   
/**
 * 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);
}
项目:PDFReporter-Studio    文件:ApplicationActionBarAdvisor.java   
/**
 * 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);
}
项目:gama    文件:GamaActionBarAdvisor.java   
/**
 * 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;
}
项目:gama    文件:GamaActionBarAdvisor.java   
/**
 * 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;
}
项目:gama    文件:RefreshHandler.java   
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);
        }
    }
}
项目:gama    文件:DeleteResourceAction.java   
/**
 * 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);
}
项目:gama    文件:DeleteResourceAction.java   
/**
 * 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);
}
项目:gama    文件:RefreshAction.java   
/**
 * 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);
        }
    }
}
项目:gama    文件:RenameResourceAction.java   
/**
 * 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;
}
项目:gama    文件:CloseResourceAction.java   
/**
 * Validates the operation against the model providers.
 *
 * @return whether the operation should proceed
 */
private boolean validateClose() {
    final IResourceChangeDescriptionFactory factory = ResourceChangeValidator.getValidator().createDeltaFactory();
    final List<? extends IResource> resources = getActionResources();
    for (final IResource resource : resources) {
        if (resource instanceof IProject) {
            final IProject project = (IProject) resource;
            factory.close(project);
        }
    }
    String message;
    if (resources.size() == 1) {
        message = NLS.bind(IDEWorkbenchMessages.CloseResourceAction_warningForOne, resources.get(0).getName());
    } else {
        message = IDEWorkbenchMessages.CloseResourceAction_warningForMultiple;
    }
    return IDE.promptToConfirm(WorkbenchHelper.getShell(), IDEWorkbenchMessages.CloseResourceAction_confirm,
            message, factory.getDelta(), getModelProviderIds(), false /* no need to syncExec */);
}
项目:gama    文件:CloseResourceAction.java   
/**
 * 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);
}
项目:limpet    文件:ApplicationWorkbenchWindowAdvisor.java   
public Control createEmptyWindowContents(Composite parent)
{
  final IWorkbenchWindow window = getWindowConfigurer().getWindow();
  Composite composite = new Composite(parent, SWT.NONE);
  composite.setLayout(new GridLayout(2, false));
  Display display = composite.getDisplay();
  Color bgCol = display.getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND);
  composite.setBackground(bgCol);
  Label label = new Label(composite, SWT.WRAP);
  label.setForeground(display
      .getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND));
  label.setBackground(bgCol);
  label.setFont(JFaceResources.getFontRegistry().getBold(
      JFaceResources.DEFAULT_FONT));
  String msg = IDEWorkbenchMessages.IDEWorkbenchAdvisor_noPerspective;
  label.setText(msg);
  ToolBarManager toolBarManager = new ToolBarManager();
  // TODO: should obtain the open perspective action from ActionFactory
  openPerspectiveAction =
      ActionFactory.OPEN_PERSPECTIVE_DIALOG.create(window);
  toolBarManager.add(openPerspectiveAction);
  ToolBar toolBar = toolBarManager.createControl(composite);
  toolBar.setBackground(bgCol);
  return composite;
}
项目:limpet    文件:ApplicationActionBarAdvisor.java   
/**
 * 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());
  Separator sep = new Separator(IWorkbenchActionConstants.MB_ADDITIONS);
  sep.setVisible(!Util.isMac());
  menu.add(sep);

  menu.add(ContributionItemFactory.OPEN_WINDOWS.create(getWindow()));
  return menu;
}
项目:limpet    文件:ApplicationActionBarAdvisor.java   
/**
 * 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(getSavePerspectiveItem());
  menu.add(getResetPerspectiveItem());
  menu.add(closePerspAction);
  menu.add(closeAllPerspsAction);
}
项目:APICloud-Studio    文件:NewUZProjectWizardPage.java   
protected boolean validatePage() {
    canFinish=false;    
       getShell().setText(Messages.CREATEPROJECTWIZARD);
      IWorkspace workspace = IDEWorkbenchPlugin.getPluginWorkspace();

      String projectFieldContents = getProjectNameFieldValue();
      if (projectFieldContents.equals("")) {
          setErrorMessage(null);
          setMessage(IDEWorkbenchMessages.WizardNewProjectCreationPage_projectNameEmpty);
          return false;
      }

      IStatus nameStatus = workspace.validateName(projectFieldContents,
              IResource.PROJECT);
      if (!nameStatus.isOK()) {
          setErrorMessage(nameStatus.getMessage());
          return false;
      }

      IProject handle = getProjectHandle();
      if (handle.exists()) {
          setErrorMessage(IDEWorkbenchMessages.WizardNewProjectCreationPage_projectExistsMessage);
          return false;
      }
return dialogChanged();
  }
项目:erflute    文件:InternalFileDialog.java   
@Override
protected Control createDialogArea(Composite parent) {
    final Composite topLevel = new Composite(parent, SWT.NONE);
    topLevel.setLayout(new GridLayout());
    topLevel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
    topLevel.setFont(parent.getFont());
    resourceGroup = new ResourceAndContainerGroup(topLevel, this, "File name:",
            IDEWorkbenchMessages.WizardNewFileCreationPage_file, false, 250);
    resourceGroup.setResourceExtension(fileExtension);
    resourceGroup.setContainerFullPath(new Path(initialFolder).removeLastSegments(1));
    if (new Path(initialFolder).lastSegment() != null) {
        resourceGroup.setResource(new Path(initialFolder).lastSegment());
        resourceGroup.setFocus();
    }
    setTitle("File");
    return super.createDialogArea(parent);
}
项目:ModelDebugging    文件:NewGemocModelingProjectCreationWizardPage.java   
/**
 * 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;
}
项目:OpenSPIFe    文件:AbstractEnsembleProjectExportWizardPage.java   
/**
    * This override is provided to provide an appropriate shell vs the standard
    * approach of just using the container.
    */
   @Override
protected boolean queryYesNoQuestion(String message) {
           MessageDialog dialog = new MessageDialog(getShellForMessageDialog(),
                   IDEWorkbenchMessages.Question,
                   (Image) null, message, MessageDialog.NONE,
                   new String[] { IDialogConstants.YES_LABEL,
                           IDialogConstants.NO_LABEL }, 0) {
            @Override
            protected int getShellStyle() {
                return super.getShellStyle() | SWT.SHEET;
            }
           };
           // ensure yes is the default

           return dialog.open() == 0;
       }
项目:OpenSPIFe    文件:EnsembleActionBarAdvisor.java   
/**
     * Create the "Edit" menu. This adds the undo, redo, cut, copy, paste,
     * delete, select all, and collapse all options to the menu.
     * 
     * @param window
     * @return
     */
    protected IMenuManager createEditMenu() {
        IMenuManager menu = new MenuManager(IDEWorkbenchMessages.Workbench_edit, IWorkbenchActionConstants.M_EDIT);
        menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_START));
        menu.add(getGlobalAction(ActionFactory.UNDO));
        menu.add(getGlobalAction(ActionFactory.REDO));
        menu.add(new GroupMarker(IWorkbenchActionConstants.UNDO_EXT));
        menu.add(new Separator());
        menu.add(getGlobalAction(ActionFactory.CUT));
        menu.add(getGlobalAction(ActionFactory.COPY));
        menu.add(getGlobalAction(ActionFactory.PASTE));
//      menu.add(getGlobalAction(EnsembleActionFactory.PASTE_SPECIAL));
        menu.add(new GroupMarker(IWorkbenchActionConstants.CUT_EXT));
        menu.add(new Separator());
        menu.add(getGlobalAction(ActionFactory.DELETE));
        menu.add(getGlobalAction(ActionFactory.SELECT_ALL));
        menu.add(new Separator());
        menu.add(getGlobalAction(ActionFactory.FIND));
        menu.add(new GroupMarker(IWorkbenchActionConstants.FIND_EXT));
        menu.add(new Separator());
        menu.add(new GroupMarker(IWorkbenchActionConstants.ADD_EXT));
        menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
        menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_END));
        return menu;
    }
项目:OpenSPIFe    文件:EnsembleActionBarAdvisor.java   
/**
 * Create the "Help" menu.
 * 
 * @param window
 * @return the help MenuManager
 */
protected IMenuManager createHelpMenu() {
    IMenuManager menu = new MenuManager(IDEWorkbenchMessages.Workbench_help, IWorkbenchActionConstants.M_HELP);
    menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_START));
       menu.add(new Separator());
       menu.add(getGlobalAction(ActionFactory.DYNAMIC_HELP));
       menu.add(getGlobalAction(ActionFactory.HELP_CONTENTS));
    menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
    menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_END));
       menu.add(new Separator());
       IWorkbenchAction about = getGlobalAction(ActionFactory.ABOUT);
    ActionContributionItem aboutItem = new ActionContributionItem(about);
    menu.add(aboutItem);
    if (Platform.OS_MACOSX.equals(Platform.getOS())) {
        aboutItem.setVisible(false);
    }
    return menu;
}
项目:translationstudio8    文件:DeleteResourceAndCloseEditorAction.java   
/**
 * 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(IResource[] resources) {
    String title;
    String msg;
    if (resources.length == 1) {
        title = IDEWorkbenchMessages.DeleteResourceAction_title1;
        IResource resource = resources[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, new Integer(
                    resources.length));
        } else {
            msg = NLS.bind(IDEWorkbenchMessages.DeleteResourceAction_confirmN, new Integer(resources.length));
        }
    }
    return MessageDialog.openQuestion(shellProvider.getShell(), title, msg);
}
项目:tmxeditor8    文件:DeleteResourceAndCloseEditorAction.java   
/**
 * 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(IResource[] resources) {
    String title;
    String msg;
    if (resources.length == 1) {
        title = IDEWorkbenchMessages.DeleteResourceAction_title1;
        IResource resource = resources[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, new Integer(
                    resources.length));
        } else {
            msg = NLS.bind(IDEWorkbenchMessages.DeleteResourceAction_confirmN, new Integer(resources.length));
        }
    }
    return MessageDialog.openQuestion(shellProvider.getShell(), title, msg);
}
项目:Pydev    文件:CopyFilesAndFoldersOperation.java   
/**
 * Validates the copy or move operation.
 *
 * @param resources
 *            the resources being copied or moved
 * @param destinationPath
 *            the destination of the copy or move
 * @return whether the operation should proceed
 * @since 3.2
 */
private boolean validateOperation(IResource[] resources, IPath destinationPath) {
    IResourceChangeDescriptionFactory factory = ResourceChangeValidator.getValidator().createDeltaFactory();
    for (int i = 0; i < resources.length; i++) {
        IResource resource = resources[i];
        if (isMove()) {
            factory.move(resource, destinationPath.append(resource.getName()));
        } else {
            factory.copy(resource, destinationPath.append(resource.getName()));
        }
    }
    String title;
    String message;
    if (isMove()) {
        title = IDEWorkbenchMessages.CopyFilesAndFoldersOperation_confirmMove;
        message = IDEWorkbenchMessages.CopyFilesAndFoldersOperation_warningMove;
    } else {
        title = IDEWorkbenchMessages.CopyFilesAndFoldersOperation_confirmCopy;
        message = IDEWorkbenchMessages.CopyFilesAndFoldersOperation_warningCopy;
    }
    return IDE
            .promptToConfirm(messageShell, title, message, factory.getDelta(), modelProviderIds,
                    true /* syncExec */);
}
项目:n4js    文件:AbstractExportToSingleFileWizardPage.java   
/**
 * Displays a Yes/No question to the user with the specified message and returns the user's response.
 *
 * @param message
 *            the question to ask
 * @return <code>true</code> for Yes, and <code>false</code> for No
 */
private boolean queryYesNoQuestion(String message) {
    MessageDialog dialog = new MessageDialog(getContainer().getShell(),
            IDEWorkbenchMessages.Question,
            (Image) null, message, MessageDialog.NONE,
            new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0) {
        @Override
        protected int getShellStyle() {
            return super.getShellStyle() | SWT.SHEET;
        }
    };
    return dialog.open() == 0;
}
项目:n4js    文件:AbstractExportToSingleFileWizardPage.java   
/**
 * Create the options specification widgets.
 */
protected void createOptionsGroup(Composite parent) {
    // options group
    Group optionsGroup = new Group(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    optionsGroup.setLayout(layout);
    optionsGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL
            | GridData.GRAB_HORIZONTAL));
    optionsGroup.setText(IDEWorkbenchMessages.WizardExportPage_options);
    optionsGroup.setFont(parent.getFont());

    createOptionsGroupButtons(optionsGroup);

}
项目:n4js    文件:AbstractExportToSingleFileWizardPage.java   
/**
 * Display an error dialog with the information from the supplied exception.
 */
private void displayErrorDialog(Throwable exception) {
    String message = exception.getMessage();
    // Some system exceptions have no message
    if (message == null) {
        message = NLS.bind(IDEWorkbenchMessages.WizardDataTransfer_exceptionMessage, exception);
    }
    displayErrorDialog(message);
}
项目:Hydrograph    文件:Application.java   
/**
   * Return true if the argument directory is ok to use as a workspace and
   * false otherwise. A version check will be performed, and a confirmation
   * box may be displayed on the argument shell if an older version is
   * detected.
   * 
   * @return true if the argument URL is ok to use as a workspace and false
   *         otherwise.
   */
  private boolean checkValidWorkspace(Shell shell, URL url) {
      // a null url is not a valid workspace
      if (url == null) {
    return false;
}

      String version = readWorkspaceVersion(url);

      // if the version could not be read, then there is not any existing
      // workspace data to trample, e.g., perhaps its a new directory that
      // is just starting to be used as a workspace
      if (version == null) {
    return true;
}

      final int ide_version = Integer.parseInt(WORKSPACE_VERSION_VALUE);
      int workspace_version = Integer.parseInt(version);

      // equality test is required since any version difference (newer
      // or older) may result in data being trampled
      if (workspace_version == ide_version) {
    return true;
}

      // At this point workspace has been detected to be from a version
      // other than the current ide version -- find out if the user wants
      // to use it anyhow.
      String title = IDEWorkbenchMessages.IDEApplication_versionTitle_newerWorkspace;
      String message = NLS.bind(IDEWorkbenchMessages.IDEApplication_versionMessage_newerWorkspace, url.getFile());

      MessageBox mbox = new MessageBox(shell, SWT.OK | SWT.CANCEL
              | SWT.ICON_WARNING | SWT.APPLICATION_MODAL);
      mbox.setText(title);
      mbox.setMessage(message);
      return mbox.open() == SWT.OK;
  }
项目:bdf2    文件:WizardNewFileCreationPage.java   
/**
 * (non-Javadoc) Method declared on IDialogPage.
 */
public void createControl(Composite parent) {
    initializeDialogUnits(parent);
    // top level group
    Composite topLevel = new Composite(parent, SWT.NONE);
    topLevel.setLayout(new GridLayout());
    topLevel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL
            | GridData.HORIZONTAL_ALIGN_FILL));
    topLevel.setFont(parent.getFont());
    PlatformUI.getWorkbench().getHelpSystem()
            .setHelp(topLevel, IIDEHelpContextIds.NEW_FILE_WIZARD_PAGE);

    // resource and container group
    resourceGroup = new ResourceAndContainerGroup(topLevel, this,
            getNewFileLabel(),
            IDEWorkbenchMessages.WizardNewFileCreationPage_file, false,
            SIZING_CONTAINER_GROUP_HEIGHT);
    resourceGroup.setAllowExistingResources(initialAllowExistingResources);
    initialPopulateContainerNameField();
    createAdvancedControls(topLevel);
    if (initialFileName != null) {
        resourceGroup.setResource(initialFileName);
    }
    if (initialFileExtension != null) {
        resourceGroup.setResourceExtension(initialFileExtension);
    }
    validatePage();
    // Show description on opening
    setErrorMessage(null);
    setMessage(null);
    setControl(topLevel);
}
项目:ncl30-eclipse    文件:NCLProjectWizardPage.java   
/**
   * Creates the project name specification controls.
   *
   * @param parent the parent composite
   */
  private final void createProjectNameGroup(Composite parent) {
      // project specification group
      Composite projectGroup = new Composite(parent, SWT.NONE);
      GridLayout layout = new GridLayout();
      layout.numColumns = 2;
      projectGroup.setLayout(layout);
      projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

      // new project label
      Label projectLabel = new Label(projectGroup, SWT.NONE);
      projectLabel.setText(IDEWorkbenchMessages.WizardNewProjectCreationPage_nameLabel);
      projectLabel.setFont(parent.getFont());

      // new project name entry field
      projectNameField = new Text(projectGroup, SWT.BORDER);
      GridData data = new GridData(GridData.FILL_HORIZONTAL);
      data.widthHint = SIZING_TEXT_FIELD_WIDTH;
      projectNameField.setLayoutData(data);
      projectNameField.setFont(parent.getFont());

      // Set the initial value first before listener
      // to avoid handling an event during the creation.
      if (initialProjectFieldValue != null) {
    projectNameField.setText(initialProjectFieldValue);
}
      projectNameField.addListener(SWT.Modify, nameModifyListener);
  }
项目:ncl30-eclipse    文件:NCLProjectWizardPage.java   
/**
   * Returns whether this page's controls currently all contain valid 
   * values.
   *
   * @return <code>true</code> if all controls are valid, and
   *   <code>false</code> if at least one is invalid
   */
  protected boolean validatePage() {
      IWorkspace workspace = IDEWorkbenchPlugin.getPluginWorkspace();

      String projectFieldContents = getProjectNameFieldValue();
      if (projectFieldContents.equals("")) { //$NON-NLS-1$
          setErrorMessage(null);
          setMessage(IDEWorkbenchMessages.WizardNewProjectCreationPage_projectNameEmpty);
          return false;
      }

      IStatus nameStatus = workspace.validateName(projectFieldContents,
              IResource.PROJECT);
      if (!nameStatus.isOK()) {
          setErrorMessage(nameStatus.getMessage());
          return false;
      }

      IProject handle = getProjectHandle();
      if (handle.exists()) {
          setErrorMessage(IDEWorkbenchMessages.WizardNewProjectCreationPage_projectExistsMessage);
          return false;
      }

      IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
        getProjectNameFieldValue());
locationArea.setExistingProject(project);

String validLocationMessage = locationArea.checkValidLocation();
if (validLocationMessage != null) { // there is no destination location given
    setErrorMessage(validLocationMessage);
    return false;
}

      setErrorMessage(null);
      setMessage(null);
      return true;
  }
项目:NEXCORE-UML-Modeler    文件:ContainerGroup.java   
/**
 * Returns a <code>boolean</code> indicating whether a container name
 * represents a valid container resource in the workbench. An error message
 * is stored for future reference if the name does not represent a valid
 * container.
 * 
 * @return <code>boolean</code> indicating validity of the container name
 */
protected boolean validateContainer() {
    IPath path = containerGroup.getContainerFullPath();
    if (path == null) {
        problemType = PROBLEM_CONTAINER_EMPTY;
        problemMessage = IDEWorkbenchMessages.ResourceGroup_folderEmpty;
        return false;
    }
    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    String projectName = path.segment(0);
    if (projectName == null || !workspace.getRoot().getProject(projectName).exists()) {
        problemType = PROBLEM_PROJECT_DOES_NOT_EXIST;
        problemMessage = IDEWorkbenchMessages.ResourceGroup_noProject;
        return false;
    }
    // path is invalid if any prefix is occupied by a file
    IWorkspaceRoot root = workspace.getRoot();
    while (path.segmentCount() > 1) {
        if (root.getFile(path).exists()) {
            problemType = PROBLEM_PATH_OCCUPIED;
            problemMessage = NLS.bind(IDEWorkbenchMessages.ResourceGroup_pathOccupied, path.makeRelative());
            return false;
        }
        path = path.removeLastSegments(1);
    }
    return true;
}
项目:NEXCORE-UML-Modeler    文件:FragmentSaveDialog.java   
/**
 * Returns whether this page's visual components all contain valid values.
 * 
 * @return <code>true</code> if valid, and <code>false</code> otherwise
 */
private boolean validatePage() {
    if (!resourceGroup.areAllValuesValid()) {
        if (!resourceGroup.getResource().equals(UICoreConstant.PROJECT_CONSTANTS__EMPTY_STRING)) {
            setErrorMessage(resourceGroup.getProblemMessage());
        } else {
            setErrorMessage(null);
        }
        return false;
    }

    String resourceName = resourceGroup.getResource();
    IWorkspace workspace = ResourcesPlugin.getWorkspace();

    // Do not allow a closed project to be selected
    IPath fullPath = resourceGroup.getContainerFullPath();
    if (fullPath != null) {
        String projectName = fullPath.segment(0);
        IStatus isValidProjectName = workspace.validateName(projectName, IResource.PROJECT);
        if (isValidProjectName.isOK()) {
            IProject project = workspace.getRoot().getProject(projectName);
            if (!project.isOpen()) {
                setErrorMessage(IDEWorkbenchMessages.SaveAsDialog_closedProjectMessage);
                return false;
            }
        }
    }

    IStatus result = workspace.validateName(resourceName, IResource.FILE);
    if (!result.isOK()) {
        setErrorMessage(result.getMessage());
        return false;
    }

    setErrorMessage(null);
    return true;
}
项目:NEXCORE-UML-Modeler    文件:UMLWizardNewProjectCreationPage.java   
/**
 * Returns whether this page's controls currently all contain valid 
 * values.
 *
 * @return <code>true</code> if all controls are valid, and
 *   <code>false</code> if at least one is invalid
 */
protected boolean validatePage() {
    IWorkspace workspace = IDEWorkbenchPlugin.getPluginWorkspace();

    String projectFieldContents = getProjectNameFieldValue();
    if (projectFieldContents.equals("")) { //$NON-NLS-1$
        setErrorMessage(null);
        setMessage(IDEWorkbenchMessages.WizardNewProjectCreationPage_projectNameEmpty);
        return false;
    }

    IStatus nameStatus = workspace.validateName(projectFieldContents,
            IResource.PROJECT);
    if (!nameStatus.isOK()) {
        setErrorMessage(nameStatus.getMessage());
        return false;
    }

    IProject handle = getProjectHandle();
    if (handle.exists()) {
        setErrorMessage(IDEWorkbenchMessages.WizardNewProjectCreationPage_projectExistsMessage);
        return false;
    }

    IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
            getProjectNameFieldValue());
    locationArea.setExistingProject(project);

    String validLocationMessage = locationArea.checkValidLocation();
    if (validLocationMessage != null) { // there is no destination location given
        setErrorMessage(validLocationMessage);
        return false;
    }

    setErrorMessage(null);
    setMessage(null);
    return true;
}
项目:PDFReporter-Studio    文件:ApplicationActionBarAdvisor.java   
/**
 * Creates and returns the Edit menu.
 */
private MenuManager createEditMenu() {
    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(getBookmarkItem());
    menu.add(getTaskItem());
    menu.add(new GroupMarker(IWorkbenchActionConstants.ADD_EXT));

    menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_END));
    menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
    return menu;
}