Examples of Saveable


Examples of hudson.model.Saveable

        for(Object obj : rawList) {
            DBObject dbObj = (DBObject) obj;
            list.add(getMapper().fromDBObject(optionalExtraInfo.getSubClass(), dbObj, getMapper().createEntityCache()));
        }

        Saveable owner = null; // TODO figure out how to associate the deserialized project here

        return new DescribableList(owner, list);
    }
View Full Code Here

Examples of org.eclipse.ui.Saveable

    public final Image getImage(Object element) {
        if (element instanceof IWorkbenchPart) {
            return ((IWorkbenchPart) element).getTitleImage();
        }
        if (element instanceof Saveable) {
          Saveable model = (Saveable) element;
          ImageDescriptor imageDesc = model.getImageDescriptor();
          // convert from ImageDescriptor to Image
          if (imageDesc == null) {
        return null;
      }
          Image image = (Image) images.get(imageDesc);
View Full Code Here

Examples of org.eclipse.ui.Saveable

                return part.getTitle();
            }
            return part.getTitle() + "  [" + path + "]"; //$NON-NLS-1$ //$NON-NLS-2$
        }
        if (element instanceof Saveable) {
          Saveable model = (Saveable) element;
            String path = model.getToolTipText();
            if (path == null || path.trim().length() == 0) {
                return model.getName();
            }
            return model.getName() + "  [" + path + "]"//$NON-NLS-1$ //$NON-NLS-2$
         
        }
        return null;
    }
View Full Code Here

Examples of org.eclipse.ui.Saveable

   */
  private static boolean saveModels(ISaveablesSource modelSource, final IWorkbenchWindow window, final boolean confirm) {
    Saveable[] selectedModels = modelSource.getActiveSaveables();
    final ArrayList dirtyModels = new ArrayList();
    for (int i = 0; i < selectedModels.length; i++) {
      Saveable model = selectedModels[i];
      if (model.isDirty()) {
        dirtyModels.add(model);
      }
    }
    if (dirtyModels.isEmpty()) {
      return true;
    }
   
    // Create save block.
    IRunnableWithProgress progressOp = new IRunnableWithProgress() {
      public void run(IProgressMonitor monitor) {
        IProgressMonitor monitorWrap = new EventLoopProgressMonitor(monitor);
        monitorWrap.beginTask(WorkbenchMessages.Save, dirtyModels.size());
        for (Iterator i = dirtyModels.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;
          }
          doSaveModel(model, new SubProgressMonitor(monitorWrap, 1),
              window, confirm);
View Full Code Here

Examples of org.eclipse.ui.Saveable

   * @since 3.2
   */
  public static boolean needsSave(ISaveablesSource modelSource) {
    Saveable[] selectedModels = modelSource.getActiveSaveables();
    for (int i = 0; i < selectedModels.length; i++) {
      Saveable model = selectedModels[i];
      if (model.isDirty() && !((InternalSaveable)model).isSavingInBackground()) {
        return true;
      }
    }
    return false;
  }
View Full Code Here

Examples of org.eclipse.ui.Saveable

    } catch (InterruptedException e) {
      return true;
    }
    // remove saveables that are no longer dirty from the list
    for (Iterator it = modelsToSave.iterator(); it.hasNext();) {
      Saveable model = (Saveable) it.next();
      if (!model.isDirty()) {
        it.remove();
      }
    }
    return false;
  }
View Full Code Here

Examples of org.eclipse.ui.Saveable

      if (canceled) {
        return false;
      }
            // Use a simpler dialog if there's only one
            if (modelsToSave.size() == 1) {
              Saveable model = (Saveable) modelsToSave.get(0);
        String message = NLS.bind(WorkbenchMessages.EditorManager_saveChangesQuestion, model.getName());
        // Show a dialog.
        String[] buttons = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL };
        MessageDialog d = new MessageDialog(
          shellProvider.getShell(), WorkbenchMessages.Save_Resource,
          null, message, MessageDialog.QUESTION, buttons, 0);
       
        int choice = SaveableHelper.testGetAutomatedResponse();
        if (SaveableHelper.testGetAutomatedResponse() == SaveableHelper.USER_RESPONSE) {
          choice = d.open();
        }

        // Branch on the user choice.
        // The choice id is based on the order of button labels
        // above.
        switch (choice) {
        case ISaveablePart2.YES: // yes
          break;
        case ISaveablePart2.NO: // no
          return true;
        default:
        case ISaveablePart2.CANCEL: // cancel
          return false;
        }
            }
            else {
              ListSelectionDialog dlg = new ListSelectionDialog(
                      shellProvider.getShell(), modelsToSave,
                      new ArrayContentProvider(),
                      new WorkbenchPartLabelProvider(), RESOURCES_TO_SAVE_MESSAGE);
              dlg.setInitialSelections(modelsToSave.toArray());
              dlg.setTitle(SAVE_RESOURCES_TITLE);
 
              // this "if" statement aids in testing.
              if (SaveableHelper.testGetAutomatedResponse()==SaveableHelper.USER_RESPONSE) {
                int result = dlg.open();
                  //Just return false to prevent the operation continuing
                  if (result == IDialogConstants.CANCEL_ID) {
            return false;
          }
 
                  modelsToSave = Arrays.asList(dlg.getResult());
              }
            }
        }
        else {
          modelsToSave = convertToSaveables(dirtyParts, closing, addNonPartSources);
    }

        // If the editor list is empty return.
        if (modelsToSave.isEmpty()) {
      return true;
    }
   
    // Create save block.
        final List finalModels = modelsToSave;
    IRunnableWithProgress progressOp = new IRunnableWithProgress() {
      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, closing || confirm);
          if (monitorWrap.isCanceled()) {
View Full Code Here

Examples of org.eclipse.ui.Saveable

    HashSet seen = new HashSet();
    for (Iterator i = parts.iterator(); i.hasNext();) {
      IWorkbenchPart part = (IWorkbenchPart) i.next();
      Saveable[] saveables = getSaveables(part);
      for (int j = 0; j < saveables.length; j++) {
        Saveable saveable = saveables[j];
        if (saveable.isDirty() && !seen.contains(saveable)) {
          seen.add(saveable);
          if (!closing
              || closingLastPartShowingModel(saveable, parts, part
                  .getSite().getPage())) {
            result.add(saveable);
          }
        }
      }
    }
    if (addNonPartSources) {
      SaveablesList saveablesList = (SaveablesList) PlatformUI
          .getWorkbench().getService(
              ISaveablesLifecycleListener.class);
      ISaveablesSource[] nonPartSources = saveablesList
          .getNonPartSources();
      for (int i = 0; i < nonPartSources.length; i++) {
        Saveable[] saveables = nonPartSources[i].getSaveables();
        for (int j = 0; j < saveables.length; j++) {
          Saveable saveable = saveables[j];
          if (saveable.isDirty() && !seen.contains(saveable)) {
            seen.add(saveable);
            result.add(saveable);
          }
        }
      }
View Full Code Here

Examples of org.eclipse.ui.Saveable

   * @param modelArray
   */
  private void removeModels(Object source, Saveable[] modelArray) {
    List removed = new ArrayList();
    for (int i = 0; i < modelArray.length; i++) {
      Saveable model = modelArray[i];
      if (removeModel(source, model)) {
        removed.add(model);
      }
    }
    if (removed.size() > 0) {
View Full Code Here

Examples of org.eclipse.ui.Saveable

   * @param modelArray
   */
  private void addModels(Object source, Saveable[] modelArray) {
    List added = new ArrayList();
    for (int i = 0; i < modelArray.length; i++) {
      Saveable model = modelArray[i];
      if (addModel(source, model)) {
        added.add(model);
      }
    }
    if (added.size() > 0) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.