Ejemplo n.º 1
0
 /** Adds a listener for problem marker changes. */
 public void addListener(IProblemChangedListener listener) {
   if (fListeners.isEmpty()) {
     CUIPlugin.getWorkspace().addResourceChangeListener(this);
     CUIPlugin.getDefault().getDocumentProvider().addGlobalAnnotationModelListener(this);
   }
   fListeners.add(listener);
 }
 @Override
 public void apply(IDocument document) {
   try {
     ITranslationUnit unit = getTranslationUnit();
     IEditorPart part = null;
     if (unit.getResource().exists()) {
       boolean canEdit = performValidateEdit(unit);
       if (!canEdit) {
         return;
       }
       part = EditorUtility.isOpenInEditor(unit);
       if (part == null) {
         part = EditorUtility.openInEditor(unit);
         if (part != null) {
           document =
               CUIPlugin.getDefault().getDocumentProvider().getDocument(part.getEditorInput());
         }
       }
       IWorkbenchPage page = CUIPlugin.getActivePage();
       if (page != null && part != null) {
         page.bringToTop(part);
       }
       if (part != null) {
         part.setFocus();
       }
     }
     performChange(part, document);
   } catch (CoreException e) {
     ExceptionHandler.handle(
         e,
         CorrectionMessages.TUCorrectionProposal_error_title,
         CorrectionMessages.TUCorrectionProposal_error_message);
   }
 }
Ejemplo n.º 3
0
 /** Removes a <code>IProblemChangedListener</code>. */
 public void removeListener(IProblemChangedListener listener) {
   fListeners.remove(listener);
   if (fListeners.isEmpty()) {
     CUIPlugin.getWorkspace().removeResourceChangeListener(this);
     CUIPlugin.getDefault().getDocumentProvider().removeGlobalAnnotationModelListener(this);
   }
 }
 private boolean performValidateEdit(ITranslationUnit unit) {
   IStatus status =
       Resources.makeCommittable(unit.getResource(), CUIPlugin.getActiveWorkbenchShell());
   if (!status.isOK()) {
     String label = CorrectionMessages.TUCorrectionProposal_error_title;
     String message = CorrectionMessages.TUCorrectionProposal_error_message;
     ErrorDialog.openError(CUIPlugin.getActiveWorkbenchShell(), label, message, status);
     return false;
   }
   return true;
 }
  private void valueChanged(boolean on, boolean store) {
    setChecked(on);
    fTreeViewer.setSorter(on ? fSorter : null);

    String key =
        ACTION_NAME + ".tooltip" + (on ? ".on" : ".off"); // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    setToolTipText(CUIPlugin.getResourceString(key));

    if (store) {
      CUIPlugin.getDefault().getDialogSettings().put(DIALOG_STORE_KEY, on);
    }
  }
Ejemplo n.º 6
0
 /* (non-Javadoc)
  * @see org.eclipse.jface.viewers.IColorProvider#getForeground(java.lang.Object)
  */
 @Override
 public Color getForeground(Object element) {
   if (element instanceof ISourceReference) {
     ISourceReference sref = (ISourceReference) element;
     if (!sref.isActive()) {
       if (fInactiveColor == null && Display.getCurrent() != null) {
         fInactiveColor = CUIPlugin.getStandardDisplay().getSystemColor(SWT.COLOR_DARK_GRAY);
         fDefaultColor = CUIPlugin.getStandardDisplay().getSystemColor(SWT.COLOR_LIST_FOREGROUND);
       }
       return fInactiveColor;
     }
   }
   return fDefaultColor;
 }
  private boolean executeExportOperation(final ICProject[] projects) {
    final String dest = getDestinationValue();
    final MultiStatus status =
        new MultiStatus(
            CUIPlugin.PLUGIN_ID, 0, Messages.TeamProjectIndexExportWizardPage_errorExporting, null);
    final boolean exportResourceSnapshot = fResourceSnapshotButton.getSelection();

    IRunnableWithProgress op =
        new IRunnableWithProgress() {
          @Override
          public void run(IProgressMonitor monitor)
              throws InvocationTargetException, InterruptedException {
            monitor.beginTask("", projects.length); // $NON-NLS-1$
            for (ICProject project : projects) {
              TeamPDOMExportOperation op = new TeamPDOMExportOperation(project);
              op.setTargetLocation(dest);
              if (exportResourceSnapshot) {
                op.setOptions(TeamPDOMExportOperation.EXPORT_OPTION_RESOURCE_SNAPSHOT);
              }
              try {
                op.run(new SubProgressMonitor(monitor, 1));
              } catch (CoreException e) {
                status.merge(e.getStatus());
              }
            }
          }
        };
    try {
      getContainer().run(true, true, op);
    } catch (InterruptedException e) {
      return false;
    } catch (InvocationTargetException e) {
      CUIPlugin.log(
          Messages.TeamProjectIndexExportWizardPage_errorExporting, e.getTargetException());
      displayErrorDialog(e.getTargetException());
      return false;
    }

    if (!status.isOK()) {
      CUIPlugin.log(status);
      ErrorDialog.openError(
          getContainer().getShell(),
          getErrorDialogTitle(),
          null, // no special message
          status);
      return false;
    }

    return true;
  }
  public LexicalSortingAction(TreeViewer treeViewer) {
    super(CUIPlugin.getResourceString(ACTION_NAME + ".label")); // $NON-NLS-1$

    setDescription(CUIPlugin.getResourceString(ACTION_NAME + ".description")); // $NON-NLS-1$
    setToolTipText(CUIPlugin.getResourceString(ACTION_NAME + ".tooltip")); // $NON-NLS-1$

    MakeUIImages.setImageDescriptors(
        this, MakeUIImages.T_TOOL, MakeUIImages.IMG_TOOLS_ALPHA_SORTING);

    fTreeViewer = treeViewer;
    fSorter = new LexicalCSorter();

    boolean checked = CUIPlugin.getDefault().getDialogSettings().getBoolean(DIALOG_STORE_KEY);
    valueChanged(checked, false);
  }
Ejemplo n.º 9
0
 @Override
 public final void run() {
   if (saveRequired) {
     EclipseObjects.getActivePage().saveAllEditors(true);
     if (EclipseObjects.getActivePage().getDirtyEditors().length != 0) {
       return;
     }
   }
   if (fEditor != null) {
     ISelectionProvider provider = fEditor.getSelectionProvider();
     if (provider != null) {
       ISelection s = provider.getSelection();
       if (s instanceof ITextSelection) {
         IWorkingCopy wc =
             CUIPlugin.getDefault()
                 .getWorkingCopyManager()
                 .getWorkingCopy(fEditor.getEditorInput());
         if (wc != null) run(fEditor.getSite(), wc, (ITextSelection) s);
       }
     }
   } else if (fSite != null) {
     if (fElement != null) {
       run(fSite, fElement);
     }
   }
 }
  /** Handler for the "Build" button. */
  private void buildConfig() {
    final IStatus[] problem = new IStatus[1];

    try {
      ProgressMonitorDialog dlg = new ProgressMonitorDialog(tree.getControl().getShell());
      dlg.run(
          true,
          true,
          new IRunnableWithProgress() {

            public void run(IProgressMonitor monitor) {
              IStatus status = currentConfig.build(monitor);
              if (status.matches(IStatus.WARNING | IStatus.ERROR)) {
                problem[0] = status;
              }
            }
          });
    } catch (Exception e) {
      CUIPlugin.log(WorkingSetMessages.WSConfigsController_buildFailedLog, e);
    }

    // it is possible that some project configurations had to applied in
    // order to effect a build. Refresh to handle that case
    updateForActivation();

    if (problem[0] != null) {
      // show the problem
      ErrorDialog.openError(
          tree.getControl().getShell(),
          WorkingSetMessages.WSConfigsController_buildFailedDlgTitle,
          WorkingSetMessages.WSConfigsController_buildFailedDlgMsg,
          problem[0]);
    }
  }
Ejemplo n.º 11
0
  public static IContainerDescriptor[] getDescriptors() {
    ArrayList<IContainerDescriptor> containers = new ArrayList<IContainerDescriptor>();

    IExtensionPoint extensionPoint =
        Platform.getExtensionRegistry().getExtensionPoint(CUIPlugin.PLUGIN_ID, ATT_EXTENSION);
    if (extensionPoint != null) {
      IContainerDescriptor defaultPage = null;
      String defaultPageName = CPathContainerDefaultPage.class.getName();

      IConfigurationElement[] elements = extensionPoint.getConfigurationElements();
      for (IConfigurationElement element : elements) {
        try {
          CPathContainerDescriptor curr = new CPathContainerDescriptor(element);
          if (defaultPageName.equals(curr.getPageClass())) {
            defaultPage = curr;
          } else {
            containers.add(curr);
          }
        } catch (CoreException e) {
          CUIPlugin.log(e);
        }
      }
      if (defaultPageName != null && containers.isEmpty()) {
        // default page only added if no other extensions found
        containers.add(defaultPage);
      }
    }
    return containers.toArray(new CPathContainerDescriptor[containers.size()]);
  }
  private Control createPreviewer(Composite parent) {
    IPreferenceStore generalTextStore = EditorsUI.getPreferenceStore();
    IPreferenceStore store =
        new ChainedPreferenceStore(new IPreferenceStore[] {getPreferenceStore(), generalTextStore});
    fPreviewViewer =
        new CSourceViewer(
            parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER, store);
    SimpleCSourceViewerConfiguration configuration =
        new SimpleCSourceViewerConfiguration(
            fColorManager, store, null, ICPartitions.C_PARTITIONING, false);
    fPreviewViewer.configure(configuration);
    Font font = JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT);
    fPreviewViewer.getTextWidget().setFont(font);
    CSourcePreviewerUpdater.registerPreviewer(fPreviewViewer, configuration, store);
    fPreviewViewer.setEditable(false);

    String content = loadPreviewContentFromFile("ColorSettingPreviewCode.txt"); // $NON-NLS-1$
    IDocument document = new Document(content);
    CUIPlugin.getDefault()
        .getTextTools()
        .setupCDocumentPartitioner(document, ICPartitions.C_PARTITIONING, null);
    fPreviewViewer.setDocument(document);

    installSemanticHighlighting();

    return fPreviewViewer.getControl();
  }
  /**
   * Creates the text change for this proposal. This method is only called once and only when no
   * text change has been passed in {@link #TUCorrectionProposal(String, ITranslationUnit,
   * TextChange, int, Image)}.
   *
   * @return returns the created text change.
   * @throws CoreException thrown if the creation of the text change failed.
   */
  protected TextChange createTextChange() throws CoreException {
    ITranslationUnit tu = getTranslationUnit();
    String name = getName();
    TextChange change;
    if (!tu.getResource().exists()) {
      String source;
      try {
        source = tu.getSource();
      } catch (CModelException e) {
        CUIPlugin.log(e);
        source = ""; // $NON-NLS-1$
      }
      Document document = new Document(source);
      document.setInitialLineDelimiter(StubUtility.getLineDelimiterUsed(tu));
      change = new DocumentChange(name, document);
    } else {
      CTextFileChange tuChange = new CTextFileChange(name, tu);
      tuChange.setSaveMode(TextFileChange.LEAVE_DIRTY);
      change = tuChange;
    }
    TextEdit rootEdit = new MultiTextEdit();
    change.setEdit(rootEdit);

    // Initialize text change.
    IDocument document = change.getCurrentDocument(new NullProgressMonitor());
    addEdits(document, rootEdit);
    return change;
  }
Ejemplo n.º 14
0
 /**
  * Constructor
  *
  * @param editor The editor on which this Add Include action should operate.
  */
 public AddIncludeAction(ITextEditor editor) {
   super(CEditorMessages.getBundleForConstructedKeys(), "AddInclude.", editor); // $NON-NLS-1$
   CUIPlugin.getDefault()
       .getWorkbench()
       .getHelpSystem()
       .setHelp(this, ICHelpContextIds.ADD_INCLUDE_ON_SELECTION_ACTION);
   final Shell shell = editor.getEditorSite().getShell();
   fAmbiguityResolver =
       new IElementSelector() {
         @SuppressWarnings("unchecked")
         @Override
         public <T> T selectElement(final Collection<T> elements) {
           final Object[] result = new Object[1];
           runInUIThread(
               new Runnable() {
                 @Override
                 public void run() {
                   ElementListSelectionDialog dialog =
                       new ElementListSelectionDialog(shell, new LabelProvider());
                   dialog.setElements(elements.toArray());
                   dialog.setTitle(CEditorMessages.AddInclude_label);
                   dialog.setMessage(CEditorMessages.AddInclude_description);
                   if (dialog.open() == Window.OK) result[0] = dialog.getFirstResult();
                 }
               });
           return (T) result[0];
         }
       };
 }
Ejemplo n.º 15
0
	private boolean openFileImpl(IProject project, IPath sourceLoc, int lineNumber) {
		if (sourceLoc == null || "??".equals(sourceLoc.toString())) return false;
		try {
			IEditorInput editorInput = getEditorInput(sourceLoc, project);
			IWorkbenchPage p= CUIPlugin.getActivePage();
			if (p != null) {
				if (editorInput == null) {
					p.openEditor(
							new STCSourceNotFoundEditorInput(project, sourceLoc, lineNumber),
							"org.eclipse.linuxtools.binutils.link2source.STCSourceNotFoundEditor",
							true);
				} else {
					IEditorPart editor = p.openEditor(editorInput, CUIPlugin.EDITOR_ID, true);
					if (lineNumber > 0 && editor instanceof ITextEditor){
						IDocumentProvider provider= ((ITextEditor)editor).getDocumentProvider();
						IDocument document= provider.getDocument(editor.getEditorInput());
						try {
							int start = document.getLineOffset(lineNumber-1);
							((ITextEditor)editor).selectAndReveal(start, 0);
							IWorkbenchPage page= editor.getSite().getPage();
							page.activate(editor);
							return true;
						} catch (BadLocationException x) {
							// ignore
						}
					}
				}
			}
		}
		catch (Exception _) {
		}
		return false;
	}
Ejemplo n.º 16
0
 /**
  * Returns the currently active C editor, or {@code null} if it cannot be determined.
  *
  * @return the currently active C editor, or {@code null}
  */
 private CEditor getCEditor() {
   IEditorPart part = CUIPlugin.getActivePage().getActiveEditor();
   if (part instanceof CEditor) {
     return (CEditor) part;
   } else {
     return null;
   }
 }
Ejemplo n.º 17
0
 /**
  * Returns the dialog settings object used to save state for this dialog.
  *
  * @return the dialog settings to be used
  */
 protected IDialogSettings getDialogSettings() {
   IDialogSettings allSettings = CUIPlugin.getDefault().getDialogSettings();
   IDialogSettings section = allSettings.getSection(fDialogSection);
   if (section == null) {
     section = allSettings.addNewSection(fDialogSection);
     writeDefaultSettings(section);
   }
   return section;
 }
 /**
  * Create a highlighted range on the previewers document with the given line, column, length and
  * key.
  *
  * @param line the line
  * @param column the column
  * @param length the length
  * @param key the key
  * @return the highlighted range
  */
 private HighlightedRange createHighlightedRange(int line, int column, int length, String key) {
   try {
     IDocument document = fPreviewViewer.getDocument();
     int offset = document.getLineOffset(line) + column;
     return new HighlightedRange(offset, length, key);
   } catch (BadLocationException x) {
     CUIPlugin.log(x);
   }
   return null;
 }
Ejemplo n.º 19
0
 private static URL makeIconFileURL(String prefix, String name) {
   StringBuffer buffer = new StringBuffer(prefix);
   buffer.append(name);
   try {
     return new URL(fgIconBaseURL, buffer.toString());
   } catch (MalformedURLException e) {
     CUIPlugin.log(e);
     return null;
   }
 }
Ejemplo n.º 20
0
 /*
  * @see ICompletionProposal#apply(IDocument)
  */
 @Override
 public void apply(IDocument document) {
   try {
     performChange(CUIPlugin.getActivePage().getActiveEditor(), document);
   } catch (CoreException e) {
     ExceptionHandler.handle(
         e,
         CorrectionMessages.ChangeCorrectionProposal_error_title,
         CorrectionMessages.ChangeCorrectionProposal_error_message);
   }
 }
Ejemplo n.º 21
0
  @Override
  protected void doFormatPreview() {
    if (fSnippets.isEmpty()) {
      fPreviewDocument.set(""); // $NON-NLS-1$
      return;
    }

    // This delimiter looks best for invisible characters
    final String delimiter = "\n"; // $NON-NLS-1$

    final StringBuilder buffer = new StringBuilder();
    for (PreviewSnippet snippet : fSnippets) {
      String formattedSource;
      try {
        TextEdit edit =
            CodeFormatterUtil.format(snippet.kind, snippet.source, 0, delimiter, fWorkingValues);
        if (edit == null) {
          formattedSource = snippet.source;
        } else {
          Document document = new Document(snippet.source);
          edit.apply(document, TextEdit.NONE);
          formattedSource = document.get();
        }
      } catch (Exception e) {
        final IStatus status =
            new Status(
                IStatus.ERROR,
                CUIPlugin.getPluginId(),
                ICStatusConstants.INTERNAL_ERROR,
                FormatterMessages.CPreview_formatter_exception,
                e);
        CUIPlugin.log(status);
        continue;
      }
      buffer.append(delimiter);
      buffer.append(formattedSource);
      buffer.append(delimiter);
      buffer.append(delimiter);
    }
    fPreviewDocument.set(buffer.toString());
  }
Ejemplo n.º 22
0
 private boolean isWorkbenchReady() {
   IWorkbenchPage activePage = window.getActivePage();
   if (activePage == null) return false;
   IEditorPart editor = activePage.getActiveEditor();
   if (editor == null || editor.getEditorInput() == null) return false;
   IWorkingCopy wc =
       CUIPlugin.getDefault().getWorkingCopyManager().getWorkingCopy(editor.getEditorInput());
   if (wc == null) return false;
   project = wc.getCProject();
   file = (IFile) wc.getResource();
   return project != null && file != null;
 }
Ejemplo n.º 23
0
 /**
  * @param language
  * @param storage
  * @param textViewer
  */
 public CSourcePresentationCreator(ILanguage language, IStorage storage, ITextViewer textViewer) {
   if (language != null) {
     fViewer = textViewer;
     fPreferenceStore = CUIPlugin.getDefault().getCombinedPreferenceStore();
     final IColorManager colorManager = CDTUITools.getColorManager();
     fSourceViewerConfiguration =
         new CustomCSourceViewerConfiguration(colorManager, fPreferenceStore, language);
     setDocumentPartitioning(fSourceViewerConfiguration.getConfiguredDocumentPartitioning(null));
     initializeDamagerRepairer(storage, colorManager, fPreferenceStore);
     fPreferenceStore.addPropertyChangeListener(this);
   }
 }
Ejemplo n.º 24
0
 /** update views (in particular, display resource configurations) */
 public static void updateViews(IResource res) {
   if (res == null) return;
   IWorkbenchPartReference refs[] =
       CUIPlugin.getActiveWorkbenchWindow().getActivePage().getViewReferences();
   for (IWorkbenchPartReference ref : refs) {
     IWorkbenchPart part = ref.getPart(false);
     if (part != null && part instanceof IPropertyChangeListener)
       ((IPropertyChangeListener) part)
           .propertyChange(
               new PropertyChangeEvent(
                   res, PreferenceConstants.PREF_SHOW_CU_CHILDREN, null, null));
   }
 }
Ejemplo n.º 25
0
 private void convertToCElements(
     ICProject project, IIndex index, IName[] declNames, List<ICElement> elements) {
   for (IName declName : declNames) {
     try {
       ICElement elem = getCElementForName(project, index, declName);
       if (elem instanceof ISourceReference) {
         elements.add(elem);
       }
     } catch (CoreException e) {
       CUIPlugin.log(e);
     }
   }
 }
Ejemplo n.º 26
0
 @Override
 public void selectionChanged(IAction action, ISelection selection) {
   boolean isTextSelection = selection != null && selection instanceof TextSelection;
   action.setEnabled(isTextSelection);
   if (!isTextSelection) return;
   // get our own selection due to (a possible) bug??
   this.selection =
       (TextSelection)
           CUIPlugin.getActivePage()
               .getActiveEditor()
               .getEditorSite()
               .getSelectionProvider()
               .getSelection();
 }
  public CPElementLabelProvider(boolean showExported, boolean showParentInfo) {
    fNewLabel = CPathEntryMessages.CPElementLabelProvider_new;
    fCreateLabel = CPathEntryMessages.CPElementLabelProvider_willbecreated;
    fRegistry = CUIPlugin.getImageDescriptorRegistry();

    fLibIcon = CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_OBJS_ARCHIVE);
    fLibWSrcIcon = CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_OBJS_ARCHIVE);
    fIncludeIcon = CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_OBJS_INCLUDES_FOLDER);
    fQuoteIncludeIcon =
        CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_OBJS_QUOTE_INCLUDES_FOLDER);
    fIncludeFileIcon = CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_OBJS_TUNIT_HEADER);
    fMacroIcon = CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_OBJS_MACRO);
    fMacrosFileIcon = CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_OBJS_TUNIT_HEADER);
    fFolderImage = CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_OBJS_SOURCE_ROOT);
    fOutputImage = CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_OBJS_CONTAINER);
    fContainerImage = CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_OBJS_LIBRARY);

    IWorkbench workbench = CUIPlugin.getDefault().getWorkbench();

    fProjectImage =
        workbench.getSharedImages().getImageDescriptor(IDE.SharedImages.IMG_OBJ_PROJECT);
    bShowExported = showExported;
    bShowParentInfo = showParentInfo;
  }
Ejemplo n.º 28
0
 private ImageDescriptor getIconFromConfig(IConfigurationElement config) {
   try {
     String iconName = config.getAttribute(ATT_ICON);
     if (iconName != null) {
       URL pluginInstallUrl =
           Platform.getBundle(config.getDeclaringExtension().getContributor().getName())
               .getEntry("/"); // $NON-NLS-1$	
       return ImageDescriptor.createFromURL(new URL(pluginInstallUrl, iconName));
     }
     return null;
   } catch (MalformedURLException exception) {
     CUIPlugin.logError("Unable to load wizard icon"); // $NON-NLS-1$
   }
   return ImageDescriptor.getMissingImageDescriptor();
 }
 private void initProjects() {
   ArrayList<ICProject> input = new ArrayList<ICProject>();
   ICProject[] projects;
   try {
     projects = CoreModel.getDefault().getCModel().getCProjects();
     for (ICProject project : projects) {
       if (project.getProject().isOpen()) {
         input.add(project);
       }
     }
   } catch (CModelException e) {
     CUIPlugin.log(e);
   }
   fProjectViewer.setInput(input);
 }
Ejemplo n.º 30
0
  /**
   * Performs the change associated with this proposal.
   *
   * @param activeEditor The editor currently active or {@code null} if no editor is active.
   * @param document The document of the editor currently active or {@code null} if no editor is
   *     visible.
   * @throws CoreException Thrown when the invocation of the change failed.
   */
  protected void performChange(IEditorPart activeEditor, IDocument document) throws CoreException {
    Change change = null;
    IRewriteTarget rewriteTarget = null;
    try {
      change = getChange();
      if (change != null) {
        if (document != null) {
          LinkedModeModel.closeAllModels(document);
        }
        if (activeEditor != null) {
          rewriteTarget = activeEditor.getAdapter(IRewriteTarget.class);
          if (rewriteTarget != null) {
            rewriteTarget.beginCompoundChange();
          }
        }

        change.initializeValidationData(new NullProgressMonitor());
        RefactoringStatus valid = change.isValid(new NullProgressMonitor());
        if (valid.hasFatalError()) {
          IStatus status =
              new Status(
                  IStatus.ERROR,
                  CUIPlugin.getPluginId(),
                  IStatus.ERROR,
                  valid.getMessageMatchingSeverity(RefactoringStatus.FATAL),
                  null);
          throw new CoreException(status);
        } else {
          IUndoManager manager = RefactoringCore.getUndoManager();
          manager.aboutToPerformChange(change);
          Change undoChange = change.perform(new NullProgressMonitor());
          manager.changePerformed(change, true);
          if (undoChange != null) {
            undoChange.initializeValidationData(new NullProgressMonitor());
            manager.addUndo(getName(), undoChange);
          }
        }
      }
    } finally {
      if (rewriteTarget != null) {
        rewriteTarget.endCompoundChange();
      }

      if (change != null) {
        change.dispose();
      }
    }
  }