Package org.eclipse.ui

Examples of org.eclipse.ui.Saveable


   * @param modelsClosing
   * @param modelsDecrementing
   */
  private void fillModelsClosing(Set modelsClosing, Map modelsDecrementing) {
    for (Iterator it = modelsDecrementing.keySet().iterator(); it.hasNext();) {
      Saveable model = (Saveable) it.next();
      if (modelsDecrementing.get(model).equals(modelRefCounts.get(model))) {
        modelsClosing.add(model);
      }
    }
  }
View Full Code Here


      if (dontPrompt) {
        modelsToSave.clear();
        return false;
      } else if (modelsToSave.size() == 1) {
        Saveable model = (Saveable) modelsToSave.get(0);
        // Show a dialog.
        String[] buttons;
        if(canCancel) {
          buttons = new String[] { IDialogConstants.YES_LABEL,
              IDialogConstants.NO_LABEL,
              IDialogConstants.CANCEL_LABEL };
        } else {
          buttons = new String[] { IDialogConstants.YES_LABEL,
              IDialogConstants.NO_LABEL};
        }

        // don't save if we don't prompt
        int choice = ISaveablePart2.NO;
       
        MessageDialog dialog;
        if (stillOpenElsewhere) {
          String message = NLS
              .bind(
                  WorkbenchMessages.EditorManager_saveChangesOptionallyQuestion,
                  model.getName());
          MessageDialogWithToggle dialogWithToggle = new MessageDialogWithToggle(shellProvider.getShell(),
              WorkbenchMessages.Save_Resource, null, message,
              MessageDialog.QUESTION, buttons, 0, WorkbenchMessages.EditorManager_closeWithoutPromptingOption, false) {
            protected int getShellStyle() {
              return (canCancel ? SWT.CLOSE : SWT.NONE)
                  | SWT.TITLE | SWT.BORDER
                  | SWT.APPLICATION_MODAL
                  | getDefaultOrientation();
            }
          };
          dialog = dialogWithToggle;
        } else {
          String message = NLS
              .bind(
                  WorkbenchMessages.EditorManager_saveChangesQuestion,
                  model.getName());
          dialog = new MessageDialog(shellProvider.getShell(),
              WorkbenchMessages.Save_Resource, null, message,
              MessageDialog.QUESTION, buttons, 0) {
            protected int getShellStyle() {
              return (canCancel ? SWT.CLOSE : SWT.NONE)
View Full Code Here

      public void run(IProgressMonitor monitor) {
        IProgressMonitor monitorWrap = new EventLoopProgressMonitor(
            monitor);
        monitorWrap.beginTask("", finalModels.size()); //$NON-NLS-1$
        for (Iterator i = finalModels.iterator(); i.hasNext();) {
          Saveable model = (Saveable) i.next();
          // handle case where this model got saved as a result of
          // saving another
          if (!model.isDirty()) {
            monitor.worked(1);
            continue;
          }
          SaveableHelper.doSaveModel(model, new SubProgressMonitor(monitorWrap, 1), shellProvider, true);
          if (monitorWrap.isCanceled())
View Full Code Here

      if (saveables != null) {
        // make a copy to avoid a ConcurrentModificationException - we
        // will remove from the original set as we iterate
        saveables = new HashSet(saveables);
        for (Iterator it2 = saveables.iterator(); it2.hasNext();) {
          Saveable saveable = (Saveable) it2.next();
          if (removeModel(part, saveable)) {
            removed.add(saveable);
          }
        }
      }
View Full Code Here

   */
  private List getFilteredSaveables(ISaveableFilter filter, Saveable[] saveables) {
    List toSave = new ArrayList();
    if (filter == null) {
      for (int i = 0; i < saveables.length; i++) {
        Saveable saveable = saveables[i];
        if (saveable.isDirty())
          toSave.add(saveable);
      }
    } else {
      SaveablesList saveablesList = (SaveablesList)getService(ISaveablesLifecycleListener.class);
      for (int i = 0; i < saveables.length; i++) {
        Saveable saveable = saveables[i];
        if (saveable.isDirty()) {
          IWorkbenchPart[] parts = saveablesList.getPartsForSaveable(saveable);
          if (matchesFilter(filter, saveable, parts))
            toSave.add(saveable);
        }
      }
View Full Code Here

TOP

Related Classes of org.eclipse.ui.Saveable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.