public void updateStatus() { if (project == null) { view.getStatusLine(0).setText(Messages.DashboardMediator_SelectProject); view.getStatusLine(1).setText(""); // $NON-NLS-1$ } else { boolean isAliveProject = false; try { if (project.getNature("net.sf.ictalive.aliveclipse.projectNature") != null) isAliveProject = true; } catch (CoreException e) { } if (isAliveProject) { view.getStatusLine(0) .setText( MessageFormat.format( Messages.DashboardMediator_Project, new Object[] {project.getName()})); double done = (double) state.getSpecifiedModelsCount() / state.getModelsCount(); view.getStatusLine(1) .setText( MessageFormat.format( Messages.DashboardMediator_Progress, new Object[] {new Double(done)})); } else { view.getStatusLine(0) .setText( MessageFormat.format( Messages.DashboardMediator_Project, new Object[] {project.getName()})); view.getStatusLine(1).setText("Not an ALIVE project"); // $NON-NLS-1$ } } for (BoxFigure<AliveDashboardState> boxFigure : view.allBoxFigures) boxFigure.refresh(); view.repaint(); // update hyperlinks }
public void setView(AliveDashboardFigure view) { this.view = view; view.viewSelectionButtonFigure.addMouseListener( new MouseListener() { public void mouseDoubleClicked(MouseEvent me) {} public void mousePressed(MouseEvent me) {} public void mouseReleased(MouseEvent me) { ViewSelectionDialog viewSelectionDialog = new ViewSelectionDialog(); viewSelectionDialog.open( AliveDashboardMediator.this, AliveDashboardMediator.this.dashboardPart); } }); view.organisationFigure.addAction( createLinkFigure(Messages.DashboardMediator_Select, new SelectOrganisationAction())); view.ontologyFigure.addAction( createLinkFigure(Messages.DashboardMediator_Select, new SelectOntologyAction())); view.taskFigure.addAction( createLinkFigure(Messages.DashboardMediator_Select, new SelectTaskAction())); view.actionFigure.addAction( createLinkFigure(Messages.DashboardMediator_Select, new SelectActionAction())); view.masFigure.addAction( createLinkFigure(Messages.DashboardMediator_Select, new SelectMASAction())); view.planFigure.addAction( createLinkFigure(Messages.DashboardMediator_Select, new SelectPlanAction())); view.organisationFigure.addAction( createLinkFigure( Messages.DashboardMediator_Edit, new EditFileDashboardAction<AliveDashboardState>() { @Override protected URI getURI() { return state.getOrganisation(); } })); view.taskFigure.addAction( createLinkFigure( Messages.DashboardMediator_Edit, new EditFileDashboardAction<AliveDashboardState>() { @Override protected URI getURI() { return state.getTask(); } })); view.actionFigure.addAction( createLinkFigure( Messages.DashboardMediator_Edit, new EditFileDashboardAction<AliveDashboardState>() { @Override protected URI getURI() { return state.getAction(); } })); view.masFigure.addAction( createLinkFigure( Messages.DashboardMediator_Edit, new EditFileDashboardAction<AliveDashboardState>() { @Override protected URI getURI() { return state.getMAS(); } })); view.planFigure.addAction( createLinkFigure( Messages.DashboardMediator_Edit, new EditFileDashboardAction<AliveDashboardState>() { @Override protected URI getURI() { return state.getPlan(); } })); view.organisationFigure.setMediator(this); view.ontologyFigure.setMediator(this); view.taskFigure.setMediator(this); view.actionFigure.setMediator(this); view.masFigure.setMediator(this); view.agentsFigure.setMediator(this); view.planFigure.setMediator(this); // for modelFigures, the label and actionId are specified in the figure itself on creation. for (BoxFigure<AliveDashboardState> boxFigure : view.allBoxFigures) for (ActionSpecification labelActionId : boxFigure.getLabelActionIds()) boxFigure.addAction( createLinkFigure( labelActionId.getLabel(), new PluginDashboardAction<AliveDashboardState>( labelActionId.getActionId(), false))); // box actions do not prompt a resource save for (FlowActionFigure flowActionFigure : view.allFlowActionFigures) for (ActionSpecification labelActionId : flowActionFigure.getLabelActionIds()) flowActionFigure.addAction( createLinkFigure( labelActionId.getLabel(), new PluginDashboardAction<AliveDashboardState>( labelActionId.getActionId(), true))); // flow actions do prompt a resource save for (DashboardActionDescriptor descriptor : Plugin.getDefault().getDashboardActionRegistry().getDescriptors()) { addDashboardAction(descriptor); } Image logoImage = Plugin.getDefault().getImageRegistry().get(Plugin.PLAY_BUTTON_IMAGE); if (logoImage != null) { view.enactmentFigure.setIcon(logoImage); view.enactmentFigureBU.setIcon(logoImage); } updateStatus(); }