Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoratikhomirov2006-05-03 13:34:32 +0000
committeratikhomirov2006-05-03 13:34:32 +0000
commitf3d28b75a5e3fc2146e416213a521aae541c3c22 (patch)
tree2f79e458c5a784a9023f6a40dd32c334b0e04704 /plugins/org.eclipse.gmf.codegen.edit
parent878b5b148bdfb8f638bc216a6258a3c05f43621c (diff)
downloadorg.eclipse.gmf-tooling-f3d28b75a5e3fc2146e416213a521aae541c3c22.tar.gz
org.eclipse.gmf-tooling-f3d28b75a5e3fc2146e416213a521aae541c3c22.tar.xz
org.eclipse.gmf-tooling-f3d28b75a5e3fc2146e416213a521aae541c3c22.zip
regenerated with EMF RC2
Diffstat (limited to 'plugins/org.eclipse.gmf.codegen.edit')
-rw-r--r--plugins/org.eclipse.gmf.codegen.edit/plugin.properties3
-rw-r--r--plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/presentation/GMFGenEditor.java559
2 files changed, 374 insertions, 188 deletions
diff --git a/plugins/org.eclipse.gmf.codegen.edit/plugin.properties b/plugins/org.eclipse.gmf.codegen.edit/plugin.properties
index 2e8f73bbf..1ed386790 100644
--- a/plugins/org.eclipse.gmf.codegen.edit/plugin.properties
+++ b/plugins/org.eclipse.gmf.codegen.edit/plugin.properties
@@ -69,6 +69,8 @@ _UI_TreeWithColumnsPage_label = Tree with Columns
_UI_ObjectColumn_label = Object
_UI_SelfColumn_label = Self
+_UI_CreateModelError_message = Problems encountered in file "{0}"
+
################
# End of section
################
@@ -414,3 +416,4 @@ _UI_LabelOffsetAttributes_y_feature = Y
_UI_GenDomainAttributeTarget_type = Gen Domain Attribute Target
_UI_GenDomainAttributeTarget_nullAsError_feature = Null As Error
_UI_GenDomainAttributeTarget_attribute_feature = Attribute
+ \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/presentation/GMFGenEditor.java b/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/presentation/GMFGenEditor.java
index 276f2e9c7..faa000f46 100644
--- a/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/presentation/GMFGenEditor.java
+++ b/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/presentation/GMFGenEditor.java
@@ -18,6 +18,9 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
+import java.util.LinkedHashMap;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
@@ -36,8 +39,14 @@ import org.eclipse.emf.common.command.BasicCommandStack;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.command.CommandStack;
import org.eclipse.emf.common.command.CommandStackListener;
+import org.eclipse.emf.common.util.BasicDiagnostic;
+import org.eclipse.emf.common.util.Diagnostic;
+
import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+
import org.eclipse.emf.common.ui.ViewerPane;
+import org.eclipse.emf.common.ui.editor.ProblemEditorPart;
import org.eclipse.emf.common.ui.viewer.IViewerProvider;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
@@ -45,6 +54,9 @@ import org.eclipse.emf.ecore.EValidator;
import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.ecore.util.EContentAdapter;
+
import org.eclipse.emf.ecore.xmi.XMLResource;
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.emf.edit.domain.EditingDomain;
@@ -61,6 +73,9 @@ import org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
import org.eclipse.emf.edit.ui.view.ExtendedPropertySheetPage;
+import org.eclipse.emf.common.ui.MarkerHelper;
+import org.eclipse.emf.edit.ui.util.EditUIMarkerHelper;
+
import org.eclipse.gmf.codegen.gmfgen.GenDiagram;
import org.eclipse.gmf.codegen.gmfgen.GenEditorGenerator;
import org.eclipse.gmf.codegen.gmfgen.provider.GMFGenItemProviderAdapterFactory;
@@ -106,6 +121,8 @@ import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IPartListener;
import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PartInitException;
+
import org.eclipse.ui.actions.WorkspaceModifyOperation;
import org.eclipse.ui.dialogs.SaveAsDialog;
import org.eclipse.ui.ide.IGotoMarker;
@@ -268,6 +285,15 @@ public class GMFGenEditor
protected ISelection editorSelection = StructuredSelection.EMPTY;
/**
+ * The MarkerHelper is responsible for creating workspace resource markers presented
+ * in Eclipse's Problems View.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected MarkerHelper markerHelper = new EditUIMarkerHelper();
+
+ /**
* This listens for when the outline becomes active
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -307,19 +333,67 @@ public class GMFGenEditor
* Resources that have been removed since last activation.
* @generated
*/
- Collection removedResources = new ArrayList();
+ protected Collection removedResources = new ArrayList();
/**
* Resources that have been changed since last activation.
* @generated
*/
- Collection changedResources = new ArrayList();
+ protected Collection changedResources = new ArrayList();
/**
* Resources that have been saved.
* @generated
*/
- Collection savedResources = new ArrayList();
+ protected Collection savedResources = new ArrayList();
+
+ /**
+ * Map to store the diagnostic associated with a resource.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Map resourceToDiagnosticMap = new LinkedHashMap();
+
+ /**
+ * Controls whether the problem indication should be updated.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected boolean updateProblemIndication = true;
+
+ /**
+ * Adapter used to update the problem indication when resources are demanded loaded.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected EContentAdapter problemIndicationAdapter =
+ new EContentAdapter() {
+ public void notifyChanged(Notification notification) {
+ if (notification.getNotifier() instanceof Resource) {
+ switch (notification.getFeatureID(Resource.class)) {
+ case Resource.RESOURCE__IS_LOADED:
+ case Resource.RESOURCE__ERRORS:
+ case Resource.RESOURCE__WARNINGS: {
+ Resource resource = (Resource)notification.getNotifier();
+ Diagnostic diagnostic = analyzeResourceProblems((Resource)notification.getNotifier(), null);
+ if (diagnostic.getSeverity() != Diagnostic.OK) {
+ resourceToDiagnosticMap.put(resource, diagnostic);
+ }
+ else {
+ resourceToDiagnosticMap.remove(resource);
+ }
+ updateProblemIndication();
+ }
+ }
+ }
+ else {
+ super.notifyChanged(notification);
+ }
+ }
+ };
/**
* This listens for workspace changes.
@@ -342,7 +416,7 @@ public class GMFGenEditor
public boolean visit(IResourceDelta delta) {
if (delta.getFlags() != IResourceDelta.MARKERS &&
- delta.getResource().getType() == IResource.FILE) {
+ delta.getResource().getType() == IResource.FILE) {
if ((delta.getKind() & (IResourceDelta.CHANGED | IResourceDelta.REMOVED)) != 0) {
Resource resource = resourceSet.getResource(URI.createURI(delta.getFullPath().toString()), false);
if (resource != null) {
@@ -437,15 +511,15 @@ public class GMFGenEditor
}
}
-
/**
* Handles what to do with changed resources on activation.
* @generated
*/
protected void handleChangedResources() {
if (!changedResources.isEmpty() && (!isDirty() || handleDirtyConflict())) {
- editingDomain.getCommandStack().flush();
+ editingDomain.getCommandStack().flush();
+ updateProblemIndication = false;
for (Iterator i = changedResources.iterator(); i.hasNext(); ) {
Resource resource = (Resource)i.next();
if (resource.isLoaded()) {
@@ -454,6 +528,68 @@ public class GMFGenEditor
resource.load(Collections.EMPTY_MAP);
}
catch (IOException exception) {
+ if (!resourceToDiagnosticMap.containsKey(resource)) {
+ resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
+ }
+ }
+ }
+ }
+ updateProblemIndication = true;
+ updateProblemIndication();
+ }
+ }
+
+ /**
+ * Updates the problems indication with the information described in the specified diagnostic.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void updateProblemIndication() {
+ if (updateProblemIndication) {
+ BasicDiagnostic diagnostic =
+ new BasicDiagnostic
+ (Diagnostic.OK,
+ "org.eclipse.gmf.codegen.edit",
+ 0,
+ null,
+ new Object [] { editingDomain.getResourceSet() });
+ for (Iterator i = resourceToDiagnosticMap.values().iterator(); i.hasNext(); ) {
+ Diagnostic childDiagnostic = (Diagnostic)i.next();
+ if (childDiagnostic.getSeverity() != Diagnostic.OK) {
+ diagnostic.add(childDiagnostic);
+ }
+ }
+
+ int lastEditorPage = getPageCount() - 1;
+ if (lastEditorPage >= 0 && getEditor(lastEditorPage) instanceof ProblemEditorPart) {
+ ((ProblemEditorPart)getEditor(lastEditorPage)).setDiagnostic(diagnostic);
+ if (diagnostic.getSeverity() != Diagnostic.OK) {
+ setActivePage(lastEditorPage);
+ }
+ }
+ else if (diagnostic.getSeverity() != Diagnostic.OK) {
+ ProblemEditorPart problemEditorPart = new ProblemEditorPart();
+ problemEditorPart.setDiagnostic(diagnostic);
+ problemEditorPart.setMarkerHelper(markerHelper);
+ try {
+ addPage(getPageCount(), problemEditorPart, getEditorInput());
+ lastEditorPage++;
+ setPageText(lastEditorPage, problemEditorPart.getPartName());
+ setActivePage(lastEditorPage);
+ }
+ catch (PartInitException exception) {
+ EditorPlugin.INSTANCE.log(exception);
+ }
+ }
+
+ if (markerHelper.hasMarkers(editingDomain.getResourceSet())) {
+ markerHelper.deleteMarkers(editingDomain.getResourceSet());
+ if (diagnostic.getSeverity() != Diagnostic.OK) {
+ try {
+ markerHelper.createMarkers(diagnostic);
+ }
+ catch (CoreException exception) {
EditorPlugin.INSTANCE.log(exception);
}
}
@@ -736,6 +872,39 @@ public class GMFGenEditor
}
/**
+ * Returns a dignostic describing the errors and warnings listed in the resource
+ * and the specified exception (if any).
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Diagnostic analyzeResourceProblems(Resource resource, Exception exception) {
+ if (!resource.getErrors().isEmpty() || !resource.getWarnings().isEmpty()) {
+ BasicDiagnostic basicDiagnostic =
+ new BasicDiagnostic
+ (Diagnostic.ERROR,
+ "org.eclipse.gmf.codegen.edit",
+ 0,
+ getString("_UI_CreateModelError_message", resource.getURI()),
+ new Object [] { exception == null ? (Object)resource : exception });
+ basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true));
+ return basicDiagnostic;
+ }
+ else if (exception != null) {
+ return
+ new BasicDiagnostic
+ (Diagnostic.ERROR,
+ "org.eclipse.gmf.codegen.edit",
+ 0,
+ getString("_UI_CreateModelError_message", resource.getURI()),
+ new Object[] { exception });
+ }
+ else {
+ return Diagnostic.OK_INSTANCE;
+ }
+ }
+
+ /**
* This is the method used by the framework to install your own controls.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -746,196 +915,204 @@ public class GMFGenEditor
//
createModel();
- // Create a page for the selection tree view.
+ // Only creates the other pages if there is something that can be edited
//
- {
- ViewerPane viewerPane =
- new ViewerPane(getSite().getPage(), GMFGenEditor.this) {
- public Viewer createViewer(Composite composite) {
- Tree tree = new Tree(composite, SWT.MULTI);
- TreeViewer newTreeViewer = new TreeViewer(tree);
- return newTreeViewer;
- }
- public void requestActivation() {
- super.requestActivation();
- setCurrentViewerPane(this);
- }
- };
- viewerPane.createControl(getContainer());
-
- selectionViewer = (TreeViewer)viewerPane.getViewer();
- selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
+ if (!getEditingDomain().getResourceSet().getResources().isEmpty() &&
+ !((Resource)getEditingDomain().getResourceSet().getResources().get(0)).getContents().isEmpty()) {
+ // Create a page for the selection tree view.
+ //
+ {
+ ViewerPane viewerPane =
+ new ViewerPane(getSite().getPage(), GMFGenEditor.this) {
+ public Viewer createViewer(Composite composite) {
+ Tree tree = new Tree(composite, SWT.MULTI);
+ TreeViewer newTreeViewer = new TreeViewer(tree);
+ return newTreeViewer;
+ }
+ public void requestActivation() {
+ super.requestActivation();
+ setCurrentViewerPane(this);
+ }
+ };
+ viewerPane.createControl(getContainer());
- selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
- selectionViewer.setInput(editingDomain.getResourceSet());
- viewerPane.setTitle(editingDomain.getResourceSet());
+ selectionViewer = (TreeViewer)viewerPane.getViewer();
+ selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
- new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory);
+ selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
+ selectionViewer.setInput(editingDomain.getResourceSet());
+ viewerPane.setTitle(editingDomain.getResourceSet());
- createContextMenuFor(selectionViewer);
- int pageIndex = addPage(viewerPane.getControl());
- setPageText(pageIndex, getString("_UI_SelectionPage_label"));
- }
+ new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory);
- // Create a page for the parent tree view.
- //
- {
- ViewerPane viewerPane =
- new ViewerPane(getSite().getPage(), GMFGenEditor.this) {
- public Viewer createViewer(Composite composite) {
- Tree tree = new Tree(composite, SWT.MULTI);
- TreeViewer newTreeViewer = new TreeViewer(tree);
- return newTreeViewer;
- }
- public void requestActivation() {
- super.requestActivation();
- setCurrentViewerPane(this);
- }
- };
- viewerPane.createControl(getContainer());
+ createContextMenuFor(selectionViewer);
+ int pageIndex = addPage(viewerPane.getControl());
+ setPageText(pageIndex, getString("_UI_SelectionPage_label"));
+ }
- parentViewer = (TreeViewer)viewerPane.getViewer();
- parentViewer.setAutoExpandLevel(30);
- parentViewer.setContentProvider(new ReverseAdapterFactoryContentProvider(adapterFactory));
- parentViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
+ // Create a page for the parent tree view.
+ //
+ {
+ ViewerPane viewerPane =
+ new ViewerPane(getSite().getPage(), GMFGenEditor.this) {
+ public Viewer createViewer(Composite composite) {
+ Tree tree = new Tree(composite, SWT.MULTI);
+ TreeViewer newTreeViewer = new TreeViewer(tree);
+ return newTreeViewer;
+ }
+ public void requestActivation() {
+ super.requestActivation();
+ setCurrentViewerPane(this);
+ }
+ };
+ viewerPane.createControl(getContainer());
- createContextMenuFor(parentViewer);
- int pageIndex = addPage(viewerPane.getControl());
- setPageText(pageIndex, getString("_UI_ParentPage_label"));
- }
+ parentViewer = (TreeViewer)viewerPane.getViewer();
+ parentViewer.setAutoExpandLevel(30);
+ parentViewer.setContentProvider(new ReverseAdapterFactoryContentProvider(adapterFactory));
+ parentViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
- // This is the page for the list viewer
- //
- {
- ViewerPane viewerPane =
- new ViewerPane(getSite().getPage(), GMFGenEditor.this) {
- public Viewer createViewer(Composite composite) {
- return new ListViewer(composite);
- }
- public void requestActivation() {
- super.requestActivation();
- setCurrentViewerPane(this);
- }
- };
- viewerPane.createControl(getContainer());
- listViewer = (ListViewer)viewerPane.getViewer();
- listViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
- listViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
-
- createContextMenuFor(listViewer);
- int pageIndex = addPage(viewerPane.getControl());
- setPageText(pageIndex, getString("_UI_ListPage_label"));
- }
+ createContextMenuFor(parentViewer);
+ int pageIndex = addPage(viewerPane.getControl());
+ setPageText(pageIndex, getString("_UI_ParentPage_label"));
+ }
- // This is the page for the tree viewer
- //
- {
- ViewerPane viewerPane =
- new ViewerPane(getSite().getPage(), GMFGenEditor.this) {
- public Viewer createViewer(Composite composite) {
- return new TreeViewer(composite);
- }
- public void requestActivation() {
- super.requestActivation();
- setCurrentViewerPane(this);
- }
- };
- viewerPane.createControl(getContainer());
- treeViewer = (TreeViewer)viewerPane.getViewer();
- treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
- treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
+ // This is the page for the list viewer
+ //
+ {
+ ViewerPane viewerPane =
+ new ViewerPane(getSite().getPage(), GMFGenEditor.this) {
+ public Viewer createViewer(Composite composite) {
+ return new ListViewer(composite);
+ }
+ public void requestActivation() {
+ super.requestActivation();
+ setCurrentViewerPane(this);
+ }
+ };
+ viewerPane.createControl(getContainer());
+ listViewer = (ListViewer)viewerPane.getViewer();
+ listViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
+ listViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
+
+ createContextMenuFor(listViewer);
+ int pageIndex = addPage(viewerPane.getControl());
+ setPageText(pageIndex, getString("_UI_ListPage_label"));
+ }
- new AdapterFactoryTreeEditor(treeViewer.getTree(), adapterFactory);
+ // This is the page for the tree viewer
+ //
+ {
+ ViewerPane viewerPane =
+ new ViewerPane(getSite().getPage(), GMFGenEditor.this) {
+ public Viewer createViewer(Composite composite) {
+ return new TreeViewer(composite);
+ }
+ public void requestActivation() {
+ super.requestActivation();
+ setCurrentViewerPane(this);
+ }
+ };
+ viewerPane.createControl(getContainer());
+ treeViewer = (TreeViewer)viewerPane.getViewer();
+ treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
+ treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
- createContextMenuFor(treeViewer);
- int pageIndex = addPage(viewerPane.getControl());
- setPageText(pageIndex, getString("_UI_TreePage_label"));
- }
+ new AdapterFactoryTreeEditor(treeViewer.getTree(), adapterFactory);
- // This is the page for the table viewer.
- //
- {
- ViewerPane viewerPane =
- new ViewerPane(getSite().getPage(), GMFGenEditor.this) {
- public Viewer createViewer(Composite composite) {
- return new TableViewer(composite);
- }
- public void requestActivation() {
- super.requestActivation();
- setCurrentViewerPane(this);
- }
- };
- viewerPane.createControl(getContainer());
- tableViewer = (TableViewer)viewerPane.getViewer();
-
- Table table = tableViewer.getTable();
- TableLayout layout = new TableLayout();
- table.setLayout(layout);
- table.setHeaderVisible(true);
- table.setLinesVisible(true);
-
- TableColumn objectColumn = new TableColumn(table, SWT.NONE);
- layout.addColumnData(new ColumnWeightData(3, 100, true));
- objectColumn.setText(getString("_UI_ObjectColumn_label"));
- objectColumn.setResizable(true);
-
- TableColumn selfColumn = new TableColumn(table, SWT.NONE);
- layout.addColumnData(new ColumnWeightData(2, 100, true));
- selfColumn.setText(getString("_UI_SelfColumn_label"));
- selfColumn.setResizable(true);
-
- tableViewer.setColumnProperties(new String [] {"a", "b"});
- tableViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
- tableViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
-
- createContextMenuFor(tableViewer);
- int pageIndex = addPage(viewerPane.getControl());
- setPageText(pageIndex, getString("_UI_TablePage_label"));
- }
+ createContextMenuFor(treeViewer);
+ int pageIndex = addPage(viewerPane.getControl());
+ setPageText(pageIndex, getString("_UI_TreePage_label"));
+ }
- // This is the page for the table tree viewer.
- //
- {
- ViewerPane viewerPane =
- new ViewerPane(getSite().getPage(), GMFGenEditor.this) {
- public Viewer createViewer(Composite composite) {
- return new TreeViewer(composite);
- }
- public void requestActivation() {
- super.requestActivation();
- setCurrentViewerPane(this);
- }
- };
- viewerPane.createControl(getContainer());
+ // This is the page for the table viewer.
+ //
+ {
+ ViewerPane viewerPane =
+ new ViewerPane(getSite().getPage(), GMFGenEditor.this) {
+ public Viewer createViewer(Composite composite) {
+ return new TableViewer(composite);
+ }
+ public void requestActivation() {
+ super.requestActivation();
+ setCurrentViewerPane(this);
+ }
+ };
+ viewerPane.createControl(getContainer());
+ tableViewer = (TableViewer)viewerPane.getViewer();
+
+ Table table = tableViewer.getTable();
+ TableLayout layout = new TableLayout();
+ table.setLayout(layout);
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+
+ TableColumn objectColumn = new TableColumn(table, SWT.NONE);
+ layout.addColumnData(new ColumnWeightData(3, 100, true));
+ objectColumn.setText(getString("_UI_ObjectColumn_label"));
+ objectColumn.setResizable(true);
+
+ TableColumn selfColumn = new TableColumn(table, SWT.NONE);
+ layout.addColumnData(new ColumnWeightData(2, 100, true));
+ selfColumn.setText(getString("_UI_SelfColumn_label"));
+ selfColumn.setResizable(true);
+
+ tableViewer.setColumnProperties(new String [] {"a", "b"});
+ tableViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
+ tableViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
+
+ createContextMenuFor(tableViewer);
+ int pageIndex = addPage(viewerPane.getControl());
+ setPageText(pageIndex, getString("_UI_TablePage_label"));
+ }
- treeViewerWithColumns = (TreeViewer)viewerPane.getViewer();
+ // This is the page for the table tree viewer.
+ //
+ {
+ ViewerPane viewerPane =
+ new ViewerPane(getSite().getPage(), GMFGenEditor.this) {
+ public Viewer createViewer(Composite composite) {
+ return new TreeViewer(composite);
+ }
+ public void requestActivation() {
+ super.requestActivation();
+ setCurrentViewerPane(this);
+ }
+ };
+ viewerPane.createControl(getContainer());
- Tree tree = treeViewerWithColumns.getTree();
- tree.setLayoutData(new FillLayout());
- tree.setHeaderVisible(true);
- tree.setLinesVisible(true);
+ treeViewerWithColumns = (TreeViewer)viewerPane.getViewer();
- TreeColumn objectColumn = new TreeColumn(tree, SWT.NONE);
- objectColumn.setText(getString("_UI_ObjectColumn_label"));
- objectColumn.setResizable(true);
- objectColumn.setWidth(250);
+ Tree tree = treeViewerWithColumns.getTree();
+ tree.setLayoutData(new FillLayout());
+ tree.setHeaderVisible(true);
+ tree.setLinesVisible(true);
- TreeColumn selfColumn = new TreeColumn(tree, SWT.NONE);
- selfColumn.setText(getString("_UI_SelfColumn_label"));
- selfColumn.setResizable(true);
- selfColumn.setWidth(200);
+ TreeColumn objectColumn = new TreeColumn(tree, SWT.NONE);
+ objectColumn.setText(getString("_UI_ObjectColumn_label"));
+ objectColumn.setResizable(true);
+ objectColumn.setWidth(250);
- treeViewerWithColumns.setColumnProperties(new String [] {"a", "b"});
- treeViewerWithColumns.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
- treeViewerWithColumns.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
+ TreeColumn selfColumn = new TreeColumn(tree, SWT.NONE);
+ selfColumn.setText(getString("_UI_SelfColumn_label"));
+ selfColumn.setResizable(true);
+ selfColumn.setWidth(200);
- createContextMenuFor(treeViewerWithColumns);
- int pageIndex = addPage(viewerPane.getControl());
- setPageText(pageIndex, getString("_UI_TreeWithColumnsPage_label"));
- }
+ treeViewerWithColumns.setColumnProperties(new String [] {"a", "b"});
+ treeViewerWithColumns.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
+ treeViewerWithColumns.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
- setActivePage(0);
+ createContextMenuFor(treeViewerWithColumns);
+ int pageIndex = addPage(viewerPane.getControl());
+ setPageText(pageIndex, getString("_UI_TreeWithColumnsPage_label"));
+ }
+ setActivePage(0);
+ }
+
+ // Ensures that this editor will only display the page's tab
+ // area if there are more than one page
+ //
getContainer().addControlListener
(new ControlAdapter() {
boolean guard = false;
@@ -946,7 +1123,9 @@ public class GMFGenEditor
guard = false;
}
}
- });
+ });
+
+ updateProblemIndication();
}
/**
@@ -1154,25 +1333,26 @@ public class GMFGenEditor
// This is the method that gets invoked when the operation runs.
//
public void execute(IProgressMonitor monitor) {
- try {
- // Save the resources to the file system.
- //
- boolean first = true;
- for (Iterator i = editingDomain.getResourceSet().getResources().iterator(); i.hasNext(); ) {
- Resource resource = (Resource)i.next();
- if ((first || !resource.getContents().isEmpty() || isPersisted(resource)) && !editingDomain.isReadOnly(resource)) {
+ // Save the resources to the file system.
+ //
+ boolean first = true;
+ for (Iterator i = editingDomain.getResourceSet().getResources().iterator(); i.hasNext(); ) {
+ Resource resource = (Resource)i.next();
+ if ((first || !resource.getContents().isEmpty() || isPersisted(resource)) && !editingDomain.isReadOnly(resource)) {
+ try {
savedResources.add(resource);
resource.save(Collections.EMPTY_MAP);
}
+ catch (Exception exception) {
+ resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
+ }
first = false;
}
}
- catch (Exception exception) {
- EditorPlugin.INSTANCE.log(exception);
- }
}
};
+ updateProblemIndication = false;
try {
// This runs the options, and shows progress.
//
@@ -1188,6 +1368,9 @@ public class GMFGenEditor
//
EditorPlugin.INSTANCE.log(exception);
}
+ updateProblemIndication = true;
+
+ updateProblemIndication();
}
/**
@@ -1206,8 +1389,8 @@ public class GMFGenEditor
stream.close();
}
}
- catch (IOException e) { }
-
+ catch (IOException e) {
+ }
return result;
}

Back to the top