Skip to content
Browse files

Editor is disabled for sealed (i.e., locked) views (i.e., "All Projects"

and "All Packages").
  • Loading branch information...
1 parent 1597fc8 commit 7c4bcfc28e249f81e4cc1c0ec1b623d6c1afc4ba @cderoove committed Jan 24, 2013
View
22 ExapusRAP/src/exapus/gui/editors/view/definition/ViewDefinitionEditor.java
@@ -50,6 +50,8 @@
private ComboViewer comboMetrics;
private ComboViewer comboGraphDetails;
private ComboViewer comboVWSource;
+ private ToolBar toolbarAPI;
+ private ToolBar toolbarProjects;
@Override
public void doSave(IProgressMonitor monitor) {
@@ -127,13 +129,13 @@ public void selectionChanged(SelectionChangedEvent event) {
});
- //APIs
+ //Packages
Label lblAPILabel = new Label(parent, SWT.NONE);
lblAPILabel.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false, 1, 1));
- lblAPILabel.setText("APIs:");
+ lblAPILabel.setText("Packages:");
tableVWAPI = new TableViewer(parent, SWT.BORDER | SWT.V_SCROLL);
- ToolBar toolbarAPI = new ToolBar(parent, SWT.VERTICAL);
+ toolbarAPI = new ToolBar(parent, SWT.VERTICAL);
configureSelectionTableAndToolBar(tableVWAPI, toolbarAPI, Perspective.API_CENTRIC);
//Projects
@@ -142,7 +144,7 @@ public void selectionChanged(SelectionChangedEvent event) {
lblProjectsLabel.setText("Projects:");
tableVWProjects = new TableViewer(parent, SWT.BORDER | SWT.V_SCROLL);
- ToolBar toolbarProjects = new ToolBar(parent, SWT.VERTICAL);
+ toolbarProjects = new ToolBar(parent, SWT.VERTICAL);
configureSelectionTableAndToolBar(tableVWProjects, toolbarProjects, Perspective.PROJECT_CENTRIC);
// MetricType
@@ -333,8 +335,20 @@ public void updateControls() {
tableVWProjects.setInput(Iterables.toArray(view.getProjectSelections(),Object.class));
comboMetrics.setSelection(new StructuredSelection(view.getMetricType()));
comboGraphDetails.setSelection(new StructuredSelection(view.getGraphDetails()));
+ enableControls(!getView().sealed());
}
+ private void enableControls(boolean enabled) {
+ comboVWPerspective.getControl().setEnabled(enabled);
+ comboVWSource.getControl().setEnabled(enabled);
+ checkRenderable.setEnabled(enabled);
+ tableVWAPI.getControl().setEnabled(enabled);
+ tableVWProjects.getControl().setEnabled(enabled);
+ comboMetrics.getControl().setEnabled(enabled);
+ comboGraphDetails.getControl().setEnabled(enabled);
+ toolbarProjects.setEnabled(enabled);
+ toolbarAPI.setEnabled(enabled);
+ }
private String getWorkspaceSourceName() {
return getView().isAPICentric() ? "Workspace Packages" : "Workspace Projects";
View
16 ExapusRAP/src/exapus/model/view/View.java
@@ -26,11 +26,14 @@ public View(String n, Perspective p) {
renderable = false;
metricType = MetricType.defaultValue(getRenderable());
graphDetails = GraphDetails.defaultValue();
+ sealed = false;
}
private FactForest forest = null;
+
private File graph = null;
+
private String sourceViewName = null;
private boolean renderable;
@@ -46,7 +49,20 @@ public View(String n, Perspective p) {
private MetricType metricType;
private String name;
+
+ private boolean sealed;
+
+ public void seal() {
+ sealed = true;
+ }
+ public void unseal() {
+ sealed = false;
+ }
+
+ public boolean sealed() {
+ return sealed;
+ }
public String getSourceViewName() {
return sourceViewName;
View
2 ExapusRAP/src/exapus/model/view/ViewFactory.java
@@ -38,11 +38,13 @@ private ViewFactory() {
completePackageView.addAPISelection(universal);
completePackageView.addProjectSelection(universal);
completePackageView.setRenderable(false);
+ completePackageView.seal();
completeProjectView = new View("All Projects", Perspective.PROJECT_CENTRIC);
completeProjectView.addAPISelection(universal);
completeProjectView.addProjectSelection(universal);
completeProjectView.setRenderable(false);
+ completeProjectView.seal();
}

0 comments on commit 7c4bcfc

Please sign in to comment.
Something went wrong with that request. Please try again.