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

项目: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;
}
项目:PDFReporter-Studio    文件:ApplicationActionBarAdvisor.java   
/**
 * Update the pin action's tool bar
 */
void updatePinActionToolbar() {

    ICoolBarManager coolBarManager = getActionBarConfigurer()
            .getCoolBarManager();
    IContributionItem cbItem = coolBarManager
            .find(IWorkbenchActionConstants.TOOLBAR_NAVIGATE);
    if (!(cbItem instanceof IToolBarContributionItem)) {
        // This should not happen
        IDEWorkbenchPlugin
                .log("Navigation toolbar contribution item is missing"); //$NON-NLS-1$
        return;
    }
    IToolBarContributionItem toolBarItem = (IToolBarContributionItem) cbItem;
    IToolBarManager toolBarManager = toolBarItem.getToolBarManager();
    if (toolBarManager == null) {
        // error if this happens, navigation toolbar assumed to always exist
        IDEWorkbenchPlugin.log("Navigate toolbar is missing"); //$NON-NLS-1$
        return;
    }

    toolBarManager.update(false);
    toolBarItem.update(ICoolBarManager.SIZE);
}
项目:gama    文件:GamaActionBarAdvisor.java   
/**
 * Creates the feature-dependent actions for the menu bar.
 */
private void makeFeatureDependentActions(final IWorkbenchWindow window) {
    final AboutInfo[] infos = null;

    final IPreferenceStore prefs = IDEWorkbenchPlugin.getDefault().getPreferenceStore();

    // Optimization: avoid obtaining the about infos if the platform state is
    // unchanged from last time. See bug 75130 for details.
    final String stateKey = "platformState"; //$NON-NLS-1$
    final String prevState = prefs.getString(stateKey);
    final String currentState = String.valueOf(Platform.getStateStamp());
    final boolean sameState = currentState.equals(prevState);
    if ( !sameState ) {
        prefs.putValue(stateKey, currentState);
    }
}
项目: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;
}
项目:limpet    文件:ApplicationWorkbenchAdvisor.java   
/**
 * Activate the proxy service by obtaining it.
 */
@SuppressWarnings(
{"rawtypes", "unchecked"})
private void activateProxyService()
{
  Bundle bundle = Platform.getBundle("org.eclipse.ui.ide"); //$NON-NLS-1$
  Object proxyService = null;
  if (bundle != null)
  {
    ServiceReference ref =
        bundle.getBundleContext().getServiceReference(
            IProxyService.class.getName());
    if (ref != null)
    {
      proxyService = bundle.getBundleContext().getService(ref);
    }
  }
  if (proxyService == null)
  {
    IDEWorkbenchPlugin.log("Proxy service could not be found."); //$NON-NLS-1$
  }
}
项目:limpet    文件:ApplicationWorkbenchAdvisor.java   
public void postShutdown()
{
  if (activityHelper != null)
  {
    activityHelper.shutdown();
    activityHelper = null;
  }
  if (idleHelper != null)
  {
    idleHelper.shutdown();
    idleHelper = null;
  }
  if (workspaceUndoMonitor != null)
  {
    workspaceUndoMonitor.shutdown();
    workspaceUndoMonitor = null;
  }
  if (IDEWorkbenchPlugin.getPluginWorkspace() != null)
  {
    disconnectFromWorkspace();
  }
}
项目:limpet    文件:ApplicationWorkbenchAdvisor.java   
/**
 * Updates the old features setting and returns a map of new features.
 */
private Map<String, AboutInfo> createNewBundleGroupsMap()
{
  // retrieve list of installed bundle groups from last session
  IDialogSettings settings =
      IDEWorkbenchPlugin.getDefault().getDialogSettings();
  String[] previousFeaturesArray = settings.getArray(INSTALLED_FEATURES);

  // get a map of currently installed bundle groups and store it for next
  // session
  Map<String, AboutInfo> bundleGroups = computeBundleGroupMap();
  String[] currentFeaturesArray = new String[bundleGroups.size()];
  bundleGroups.keySet().toArray(currentFeaturesArray);
  settings.put(INSTALLED_FEATURES, currentFeaturesArray);

  // remove the previously known from the current set
  if (previousFeaturesArray != null)
  {
    for (int i = 0; i < previousFeaturesArray.length; ++i)
    {
      bundleGroups.remove(previousFeaturesArray[i]);
    }
  }

  return bundleGroups;
}
项目:limpet    文件:ApplicationWorkbenchWindowAdvisor.java   
/**
 * Tries to open the intro, if one exists and otherwise will open the legacy Welcome pages.
 * 
 * @see org.eclipse.ui.application.WorkbenchWindowAdvisor#openIntro()
 */
@SuppressWarnings("deprecation")
public void openIntro()
{
  if (editorsAndIntrosOpened)
  {
    return;
  }

  editorsAndIntrosOpened = true;

  // don't try to open the welcome editors if there is an intro
  if (wbAdvisor.hasIntro())
  {
    super.openIntro();
  }
  else
  {
    openWelcomeEditors(getWindowConfigurer().getWindow());
    // save any preferences changes caused by the above actions
    IDEWorkbenchPlugin.getDefault().savePluginPreferences();
  }
}
项目:limpet    文件:ApplicationWorkbenchWindowAdvisor.java   
public void dispose()
{
  if (propertyChangeListener != null)
  {
    IDEWorkbenchPlugin.getDefault().getPreferenceStore()
        .removePropertyChangeListener(propertyChangeListener);
    propertyChangeListener = null;
  }

  if (openPerspectiveAction != null)
  {
    openPerspectiveAction.dispose();
    openPerspectiveAction = null;
  }
  super.dispose();
}
项目:limpet    文件:ApplicationActionBarAdvisor.java   
/**
 * Update the pin action's tool bar
 */
void updatePinActionToolbar()
{

  ICoolBarManager coolBarManager =
      getActionBarConfigurer().getCoolBarManager();
  IContributionItem cbItem =
      coolBarManager.find(IWorkbenchActionConstants.TOOLBAR_NAVIGATE);
  if (!(cbItem instanceof IToolBarContributionItem))
  {
    // This should not happen
    IDEWorkbenchPlugin.log("Navigation toolbar contribution item is missing"); //$NON-NLS-1$
    return;
  }
  IToolBarContributionItem toolBarItem = (IToolBarContributionItem) cbItem;
  IToolBarManager toolBarManager = toolBarItem.getToolBarManager();
  if (toolBarManager == null)
  {
    // error if this happens, navigation toolbar assumed to always exist
    IDEWorkbenchPlugin.log("Navigate toolbar is missing"); //$NON-NLS-1$
    return;
  }

  toolBarManager.update(false);
  toolBarItem.update(ICoolBarManager.SIZE);
}
项目: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();
  }
项目: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;
}
项目:translationstudio8    文件:ImportProjectWizard.java   
/**
    * Constructor for ExternalProjectImportWizard.
    * 
    * @param initialPath Default path for wizard to import
    * @since 3.5
    */
public ImportProjectWizard(String initialPath)
   {
       super();
       this.initialPath = initialPath;
       setWindowTitle(DataTransferMessages.DataTransfer_importTitle);
       setNeedsProgressMonitor(true);
       IDialogSettings workbenchSettings = IDEWorkbenchPlugin.getDefault()
            .getDialogSettings();

    IDialogSettings wizardSettings = workbenchSettings
            .getSection(IMPORT_PROJECT_SECTION);
    if (wizardSettings == null) {
        wizardSettings = workbenchSettings
                .addNewSection(IMPORT_PROJECT_SECTION);
    }
    setDialogSettings(wizardSettings);        
   }
项目:translationstudio8    文件:FileFolderSelectionDialog.java   
public IStatus validate(Object[] selection) {
    int nSelected = selection.length;
    String pluginId = IDEWorkbenchPlugin.IDE_WORKBENCH;

    if (nSelected == 0 || (nSelected > 1 && multiSelect == false)) {
        return new Status(IStatus.ERROR, pluginId, IStatus.ERROR,
                IDEResourceInfoUtils.EMPTY_STRING, null);
    }
    for (int i = 0; i < selection.length; i++) {
        Object curr = selection[i];
        if (curr instanceof IFileStore) {
            IFileStore file = (IFileStore) curr;
            if (acceptFolders == false
                    && file.fetchInfo().isDirectory()) {
                return new Status(IStatus.ERROR, pluginId,
                        IStatus.ERROR,
                        IDEResourceInfoUtils.EMPTY_STRING, null);
            }

        }
    }
    return Status.OK_STATUS;
}
项目:Environment    文件:ApplicationWorkbenchAdvisor.java   
@Override
public void initialize(IWorkbenchConfigurer configurer) {
    super.initialize(configurer);

     configurer.setSaveAndRestore(true);
     PlatformUI.getPreferenceStore().setValue(
            IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS, false);


    // inserted: register workbench adapters
    IDE.registerAdapters();

    // inserted: register images for rendering explorer view
    final String ICONS_PATH = "icons/full/";
    final String PATH_OBJECT = ICONS_PATH + "obj16/";
    Bundle ideBundle = Platform.getBundle(IDEWorkbenchPlugin.IDE_WORKBENCH);
    declareWorkbenchImage(configurer, ideBundle,
        IDE.SharedImages.IMG_OBJ_PROJECT, PATH_OBJECT + "prj_obj.gif", true);
    declareWorkbenchImage(configurer, ideBundle,
        IDE.SharedImages.IMG_OBJ_PROJECT_CLOSED, PATH_OBJECT + "cprj_obj.gif", true);
}
项目:tmxeditor8    文件:ImportProjectWizard.java   
/**
    * Constructor for ExternalProjectImportWizard.
    * 
    * @param initialPath Default path for wizard to import
    * @since 3.5
    */
public ImportProjectWizard(String initialPath)
   {
       super();
       this.initialPath = initialPath;
       setWindowTitle(DataTransferMessages.DataTransfer_importTitle);
       setNeedsProgressMonitor(true);
       IDialogSettings workbenchSettings = IDEWorkbenchPlugin.getDefault()
            .getDialogSettings();

    IDialogSettings wizardSettings = workbenchSettings
            .getSection(IMPORT_PROJECT_SECTION);
    if (wizardSettings == null) {
        wizardSettings = workbenchSettings
                .addNewSection(IMPORT_PROJECT_SECTION);
    }
    setDialogSettings(wizardSettings);        
   }
项目:tmxeditor8    文件:FileFolderSelectionDialog.java   
public IStatus validate(Object[] selection) {
    int nSelected = selection.length;
    String pluginId = IDEWorkbenchPlugin.IDE_WORKBENCH;

    if (nSelected == 0 || (nSelected > 1 && multiSelect == false)) {
        return new Status(IStatus.ERROR, pluginId, IStatus.ERROR,
                IDEResourceInfoUtils.EMPTY_STRING, null);
    }
    for (int i = 0; i < selection.length; i++) {
        Object curr = selection[i];
        if (curr instanceof IFileStore) {
            IFileStore file = (IFileStore) curr;
            if (acceptFolders == false
                    && file.fetchInfo().isDirectory()) {
                return new Status(IStatus.ERROR, pluginId,
                        IStatus.ERROR,
                        IDEResourceInfoUtils.EMPTY_STRING, null);
            }

        }
    }
    return Status.OK_STATUS;
}
项目:Pydev    文件:CopyFilesAndFoldersOperation.java   
/**
 * Build the collection of fileStores that map to fileNames. If any of them
 * cannot be found then match then return <code>null</code>.
 *
 * @param uris
 * @return IFileStore[]
 */
private IFileStore[] buildFileStores(URI[] uris) {
    IFileStore[] stores = new IFileStore[uris.length];
    for (int i = 0; i < uris.length; i++) {
        IFileStore store;
        try {
            store = EFS.getStore(uris[i]);
        } catch (CoreException e) {
            IDEWorkbenchPlugin.log(e.getMessage(), e);
            reportFileInfoNotFound(uris[i].toString());
            return null;
        }
        if (store == null) {
            reportFileInfoNotFound(uris[i].toString());
            return null;
        }
        stores[i] = store;
    }
    return stores;

}
项目:Hydrograph    文件:Application.java   
/**
   * Look at the argument URL for the workspace's version information. Return
   * that version if found and null otherwise.
   */
  private static String readWorkspaceVersion(URL workspace) {
      File versionFile = getVersionFile(workspace, false);
      if (versionFile == null || !versionFile.exists()) {
    return null;
}

      try {
          // Although the version file is not spec'ed to be a Java properties
          // file, it happens to follow the same format currently, so using
          // Properties to read it is convenient.
          Properties props = new Properties();
          FileInputStream is = new FileInputStream(versionFile);
          try {
              props.load(is);
          } finally {
              is.close();
          }

          return props.getProperty(WORKSPACE_VERSION_KEY);
      } catch (IOException e) {
          IDEWorkbenchPlugin.log("Could not read version file", new Status( //$NON-NLS-1$
                  IStatus.ERROR, IDEWorkbenchPlugin.IDE_WORKBENCH,
                  IStatus.ERROR,
                  e.getMessage() == null ? "" : e.getMessage(), //$NON-NLS-1$, 
                  e));
          return null;
      }
  }
项目:mesfavoris    文件:ShowInSystemExplorer.java   
/**
 * Prepare command for launching system explorer to show a path
 *
 * @param path
 *            the path to show
 * @return the command that shows the path
 */
private String formShowInSystemExplorerCommand(File path) throws IOException {
    String command = IDEWorkbenchPlugin.getDefault().getPreferenceStore()
            .getString(IDEInternalPreferences.WORKBENCH_SYSTEM_EXPLORER);

    command = Util.replaceAll(command, VARIABLE_RESOURCE, quotePath(path.getCanonicalPath()));
    command = Util.replaceAll(command, VARIABLE_RESOURCE_URI, path.getCanonicalFile().toURI().toString());
    File parent = path.getParentFile();
    if (parent != null) {
        command = Util.replaceAll(command, VARIABLE_FOLDER, quotePath(parent.getCanonicalPath()));
    }
    return command;
}
项目: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;
  }
项目:typescript.java    文件:AbstractNewProjectWizard.java   
/**
 * Prompts the user for whether to switch perspectives.
 *
 * @param window
 *            The workbench window in which to switch perspectives; must not
 *            be <code>null</code>
 * @param finalPersp
 *            The perspective to switch to; must not be <code>null</code>.
 *
 * @return <code>true</code> if it's OK to switch, <code>false</code>
 *         otherwise
 */
private static boolean confirmPerspectiveSwitch(IWorkbenchWindow window, IPerspectiveDescriptor finalPersp) {
    IPreferenceStore store = IDEWorkbenchPlugin.getDefault().getPreferenceStore();
    String pspm = store.getString(IDEInternalPreferences.PROJECT_SWITCH_PERSP_MODE);
    if (!IDEInternalPreferences.PSPM_PROMPT.equals(pspm)) {
        // Return whether or not we should always switch
        return IDEInternalPreferences.PSPM_ALWAYS.equals(pspm);
    }
    String desc = finalPersp.getDescription();
    String message;
    if (desc == null || desc.length() == 0)
        message = NLS.bind(ResourceMessages.NewProject_perspSwitchMessage, finalPersp.getLabel());
    else
        message = NLS.bind(ResourceMessages.NewProject_perspSwitchMessageWithDesc,
                new String[] { finalPersp.getLabel(), desc });

    MessageDialogWithToggle dialog = MessageDialogWithToggle.openYesNoQuestion(window.getShell(),
            ResourceMessages.NewProject_perspSwitchTitle, message,
            null /* use the default message for the toggle */,
            false /* toggle is initially unchecked */, store, IDEInternalPreferences.PROJECT_SWITCH_PERSP_MODE);
    int result = dialog.getReturnCode();

    // If we are not going to prompt anymore propogate the choice.
    if (dialog.getToggleState()) {
        String preferenceValue;
        if (result == IDialogConstants.YES_ID) {
            // Doesn't matter if it is replace or new window
            // as we are going to use the open perspective setting
            preferenceValue = IWorkbenchPreferenceConstants.OPEN_PERSPECTIVE_REPLACE;
        } else {
            preferenceValue = IWorkbenchPreferenceConstants.NO_NEW_PERSPECTIVE;
        }

        // update PROJECT_OPEN_NEW_PERSPECTIVE to correspond
        PrefUtil.getAPIPreferenceStore().setValue(IDE.Preferences.PROJECT_OPEN_NEW_PERSPECTIVE, preferenceValue);
    }
    return result == IDialogConstants.YES_ID;
}
项目:NEXCORE-UML-Modeler    文件:FragmentSaveDialog.java   
/**
 * @see org.eclipse.jface.dialogs.Dialog#getDialogBoundsSettings()
 */
protected IDialogSettings getDialogBoundsSettings() {
    IDialogSettings settings = IDEWorkbenchPlugin.getDefault().getDialogSettings();
    IDialogSettings section = settings.getSection(DIALOG_SETTINGS_SECTION);
    if (section == null) {
        section = settings.addNewSection(DIALOG_SETTINGS_SECTION);
    }
    return section;
}
项目: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;
}
项目:yamcs-studio    文件:RelativeFileSystemStructureProvider.java   
@Override
public InputStream getContents(Object element) {
    try {
        return new FileInputStream((File) element);
    } catch (FileNotFoundException e) {
        IDEWorkbenchPlugin.log(e.getLocalizedMessage(), e);
    }
    return null;
}
项目:traceability-assistant-eclipse-plugins    文件:WorkbenchTreeViewer.java   
/**
 * Inits the label provider.
 *
 * @param viewer the viewer
 */
protected void initLabelProvider(TreeViewer viewer) {
    viewer.setLabelProvider(
        new DecoratingLabelProvider(
            new WorkbenchLabelProvider(),
            IDEWorkbenchPlugin.getDefault().getWorkbench().getDecoratorManager().getLabelDecorator()));
}
项目:Aspose.Total-for-Java    文件:AsposeNewMavenProjectWizardPageBase.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 validLocationMessage = locationArea.checkValidLocation();
    if (validLocationMessage != null) { // there is no destination location
                                        // given
        setErrorMessage(validLocationMessage);
        return false;
    }

    setErrorMessage(null);
    setMessage(null);
    return true;
}
项目:gwt-eclipse-plugin    文件:ModuleSelectionDialog.java   
@Override
protected IDialogSettings getDialogSettings() {
  IDialogSettings settings = IDEWorkbenchPlugin.getDefault().getDialogSettings().getSection(
      DIALOG_SETTINGS);

  if (settings == null) {
    settings = IDEWorkbenchPlugin.getDefault().getDialogSettings().addNewSection(
        DIALOG_SETTINGS);
  }
  return settings;
}
项目:PDFReporter-Studio    文件:ApplicationWorkbenchAdvisor.java   
@Override
public void initialize(IWorkbenchConfigurer configurer) {
    super.initialize(configurer);
    configurer.setSaveAndRestore(true);

    final String ICONS_PATH = "icons/full/"; //$NON-NLS-1$
    final String PATH_OBJECT = ICONS_PATH + "obj16/"; //$NON-NLS-1$
    Bundle ideBundle = Platform.getBundle(IDEWorkbenchPlugin.IDE_WORKBENCH);
    declareWorkbenchImage(configurer, ideBundle,
            IDE.SharedImages.IMG_OBJ_PROJECT, PATH_OBJECT + "prj_obj.gif", //$NON-NLS-1$
            true);
    declareWorkbenchImage(configurer, ideBundle,
            IDE.SharedImages.IMG_OBJ_PROJECT_CLOSED, PATH_OBJECT
                    + "cprj_obj.gif", true); //$NON-NLS-1$
    declareWorkbenchImage(configurer, ideBundle,
            IDEInternalWorkbenchImages.IMG_DLGBAN_SAVEAS_DLG, PATH_OBJECT
                    + "saveas_wiz.png", false); //$NON-NLS-1$
    declareWorkbenchImage(configurer, ideBundle,
            IDE.SharedImages.IMG_OBJ_PROJECT, PATH_OBJECT + "prj_obj.gif", //$NON-NLS-1$
            true);
    declareWorkbenchImage(configurer, ideBundle,
            IDE.SharedImages.IMG_OBJ_PROJECT_CLOSED, PATH_OBJECT
                    + "cprj_obj.gif", true); //$NON-NLS-1$

    // Force the default setting for the help (tray) button in dialogs.
    // It seems that in Windows and Linux platforms as default this value is set to true.
    // However in Mac OS X the button does not shown as default behavior.
    TrayDialog.setDialogHelpAvailable(true);

    // Sets the branding information
    BrandingInfo info = new BrandingInfo();
    info.setProductName(Messages.ApplicationWorkbenchAdvisor_ProductName);
    info.setProductVersion(Activator.getDefault().getBundle().getVersion().toString());
    info.setProductMainBundleID(Activator.PLUGIN_ID);
    JaspersoftStudioPlugin.getInstance().setBrandingInformation(info);
}
项目:gama    文件:ImportProjectWizardPage.java   
/**
 * The browse button has been selected. Select the location.
 */
protected void handleLocationDirectoryButtonPressed() {

    final DirectoryDialog dialog = new DirectoryDialog(directoryPathField.getShell(), SWT.SHEET);
    dialog.setMessage(DataTransferMessages.WizardProjectsImportPage_SelectDialogTitle);

    String dirName = directoryPathField.getText().trim();
    if (dirName.length() == 0) {
        dirName = previouslyBrowsedDirectory;
    }

    if (dirName.length() == 0) {
        dialog.setFilterPath(IDEWorkbenchPlugin.getPluginWorkspace().getRoot().getLocation().toOSString());
    } else {
        final File path = new File(dirName);
        if (path.exists()) {
            dialog.setFilterPath(new Path(dirName).toOSString());
        }
    }

    final String selectedDirectory = dialog.open();
    if (selectedDirectory != null) {
        previouslyBrowsedDirectory = selectedDirectory;
        directoryPathField.setText(previouslyBrowsedDirectory);
        updateProjectsList(selectedDirectory);
    }

}
项目:gama    文件:ImportProjectWizardPage.java   
/**
 * The browse button has been selected. Select the location.
 */
protected void handleLocationArchiveButtonPressed() {

    final FileDialog dialog = new FileDialog(archivePathField.getShell(), SWT.SHEET);
    dialog.setFilterExtensions(FILE_IMPORT_MASK);
    dialog.setText(DataTransferMessages.WizardProjectsImportPage_SelectArchiveDialogTitle);

    String fileName = archivePathField.getText().trim();
    if (fileName.length() == 0) {
        fileName = previouslyBrowsedArchive;
    }

    if (fileName.length() == 0) {
        dialog.setFilterPath(IDEWorkbenchPlugin.getPluginWorkspace().getRoot().getLocation().toOSString());
    } else {
        final File path = new File(fileName).getParentFile();
        if (path != null && path.exists()) {
            dialog.setFilterPath(path.toString());
        }
    }

    final String selectedArchive = dialog.open();
    if (selectedArchive != null) {
        previouslyBrowsedArchive = selectedArchive;
        archivePathField.setText(previouslyBrowsedArchive);
        updateProjectsList(selectedArchive);
    }

}
项目:gama    文件:NewProjectWizardPage.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() {
    final IWorkspace workspace = IDEWorkbenchPlugin.getPluginWorkspace();

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

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

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

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

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

    setErrorMessage(null);
    setMessage(null);
    return true;
}
项目:gama    文件:ImportProjectWizard.java   
public ImportProjectWizard(final String initialPath) {
    this.initialPath = initialPath;
    setNeedsProgressMonitor(true);
    final IDialogSettings workbenchSettings = IDEWorkbenchPlugin.getDefault().getDialogSettings();

    IDialogSettings wizardSettings = workbenchSettings.getSection(EXTERNAL_PROJECT_SECTION);
    if (wizardSettings == null) {
        wizardSettings = workbenchSettings.addNewSection(EXTERNAL_PROJECT_SECTION);
    }
    setDialogSettings(wizardSettings);
}
项目:limpet    文件:ApplicationWorkbenchAdvisor.java   
private void refreshFromLocal()
{
  String[] commandLineArgs = Platform.getCommandLineArgs();
  IPreferenceStore store =
      IDEWorkbenchPlugin.getDefault().getPreferenceStore();
  boolean refresh =
      store.getBoolean(IDEInternalPreferences.REFRESH_WORKSPACE_ON_STARTUP);
  if (!refresh)
  {
    return;
  }

  // Do not refresh if it was already done by core on startup.
  for (int i = 0; i < commandLineArgs.length; i++)
  {
    if (commandLineArgs[i].equalsIgnoreCase("-refresh"))
    {
      //$NON-NLS-1$
      return;
    }
  }

  final IContainer root = ResourcesPlugin.getWorkspace().getRoot();
  Job job = new WorkspaceJob(IDEWorkbenchMessages.Workspace_refreshing)
  {
    public IStatus runInWorkspace(IProgressMonitor monitor)
        throws CoreException
    {
      root.refreshLocal(IResource.DEPTH_INFINITE, monitor);
      return Status.OK_STATUS;
    }
  };
  job.setRule(root);
  job.schedule();
}
项目:limpet    文件:Application.java   
/**
 * Look at the argument URL for the workspace's version information. Return that version if found
 * and null otherwise.
 */
private static String readWorkspaceVersion(URL workspace)
{
  File versionFile = getVersionFile(workspace, false);
  if (versionFile == null || !versionFile.exists())
  {
    return null;
  }

  try
  {
    // Although the version file is not spec'ed to be a Java properties
    // file, it happens to follow the same format currently, so using
    // Properties to read it is convenient.
    Properties props = new Properties();
    FileInputStream is = new FileInputStream(versionFile);
    try
    {
      props.load(is);
    }
    finally
    {
      is.close();
    }

    return props.getProperty(WORKSPACE_VERSION_KEY);
  }
  catch (IOException e)
  {
    IDEWorkbenchPlugin.log(
        "Could not read version file", new Status(//$NON-NLS-1$
            IStatus.ERROR, IDEWorkbenchPlugin.IDE_WORKBENCH, IStatus.ERROR, e
                .getMessage() == null ? "" : e.getMessage(), //$NON-NLS-1$, 
            e));
    return null;
  }
}
项目:limpet    文件:ApplicationActionBarAdvisor.java   
/**
 * Adds a <code>GroupMarker</code> or <code>Separator</code> to a menu. The test for whether a
 * separator should be added is done by checking for the existence of a preference matching the
 * string useSeparator.MENUID.GROUPID that is set to <code>true</code>.
 * 
 * @param menu
 *          the menu to add to
 * @param groupId
 *          the group id for the added separator or group marker
 */
private void addSeparatorOrGroupMarker(MenuManager menu, String groupId)
{
  String prefId = "useSeparator." + menu.getId() + "." + groupId; //$NON-NLS-1$ //$NON-NLS-2$
  boolean addExtraSeparators =
      IDEWorkbenchPlugin.getDefault().getPreferenceStore().getBoolean(prefId);
  if (addExtraSeparators)
  {
    menu.add(new Separator(groupId));
  }
  else
  {
    menu.add(new GroupMarker(groupId));
  }
}
项目:APICloud-Studio    文件:ProjectContentsLocationArea.java   
private IDialogSettings getDialogSettings()
{
    IDialogSettings ideDialogSettings = IDEWorkbenchPlugin.getDefault().getDialogSettings();
    IDialogSettings result = ideDialogSettings.getSection(getClass().getName());
    if (result == null)
    {
        result = ideDialogSettings.addNewSection(getClass().getName());
    }
    return result;
}
项目:APICloud-Studio    文件:NaturesLabelProvider.java   
@Override
public Image getImage(Object element)
{

    String nature = element.toString();
    OverlayIcon oi = null;
    ImageData id = EMPTY_IMAGE.getImageData();

    try
    {
        ImageDescriptor d = IDEWorkbenchPlugin.getDefault().getProjectImageRegistry()
                .getNatureImage(element.toString());
        oi = new CenterIcon(EMPTY_IMAGE, d, new Point(id.width, id.height));
    }
    catch (Exception e)
    {
        oi = new CenterIcon(EMPTY_IMAGE, APTANA_NATURE_IMAGE, new Point(id.width, id.height));
    }

    if (UIEplPlugin.getDefault().getImageRegistry().get(nature) == null)
    {
        if (oi != null)
        {
            UIEplPlugin.getDefault().getImageRegistry().put(nature, oi.createImage());
        }
    }
    return UIEplPlugin.getDefault().getImageRegistry().get(nature);

}
项目:APICloud-Studio    文件:WizardFolderImportPage.java   
/**
 * The browse button has been selected. Select the location.
 */
protected void handleLocationDirectoryButtonPressed()
{

    DirectoryDialog dialog = new DirectoryDialog(directoryPathField.getShell());
    dialog.setMessage(DataTransferMessages.WizardProjectsImportPage_SelectDialogTitle);

    String dirName = directoryPathField.getText().trim();
    if (dirName.length() == 0)
    {
        dirName = previouslyBrowsedDirectory;
    }

    if (dirName.length() == 0)
    {
        dialog.setFilterPath(IDEWorkbenchPlugin.getPluginWorkspace().getRoot().getLocation().toOSString());
    }
    else
    {
        File path = new File(dirName);
        if (path.exists())
        {
            dialog.setFilterPath(new Path(dirName).toOSString());
        }
    }

    String selectedDirectory = dialog.open();
    if (selectedDirectory != null)
    {
        previouslyBrowsedDirectory = selectedDirectory;
        directoryPathField.setText(previouslyBrowsedDirectory);
    }

    setProjectName();

    setPageComplete(directoryPathField.getText() != null);

}
项目:APICloud-Studio    文件:WizardNewProjectCreationPage.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;
  }