|
@@ -17,6 +17,7 @@ import java.util.List;
|
|
|
import org.eclipse.core.runtime.IProgressMonitor;
|
|
import org.eclipse.core.runtime.IProgressMonitor;
|
|
|
import org.eclipse.core.runtime.IStatus;
|
|
import org.eclipse.core.runtime.IStatus;
|
|
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
|
|
|
|
+import org.eclipse.core.runtime.Platform;
|
|
|
import org.eclipse.jface.layout.GridDataFactory;
|
|
import org.eclipse.jface.layout.GridDataFactory;
|
|
|
import org.eclipse.jface.operation.IRunnableWithProgress;
|
|
import org.eclipse.jface.operation.IRunnableWithProgress;
|
|
|
import org.eclipse.jface.util.IPropertyChangeListener;
|
|
import org.eclipse.jface.util.IPropertyChangeListener;
|
|
@@ -38,6 +39,7 @@ import org.eclipse.swt.events.SelectionListener;
|
|
|
import org.eclipse.swt.layout.FillLayout;
|
|
import org.eclipse.swt.layout.FillLayout;
|
|
|
import org.eclipse.swt.layout.GridData;
|
|
import org.eclipse.swt.layout.GridData;
|
|
|
import org.eclipse.swt.layout.GridLayout;
|
|
import org.eclipse.swt.layout.GridLayout;
|
|
|
|
|
+import org.eclipse.swt.program.Program;
|
|
|
import org.eclipse.swt.widgets.Composite;
|
|
import org.eclipse.swt.widgets.Composite;
|
|
|
import org.eclipse.swt.widgets.Display;
|
|
import org.eclipse.swt.widgets.Display;
|
|
|
import org.yakindu.sct.examples.wizard.ExampleActivator;
|
|
import org.yakindu.sct.examples.wizard.ExampleActivator;
|
|
@@ -58,12 +60,10 @@ import com.google.inject.Inject;
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
public class SelectExamplePage extends WizardPage
|
|
public class SelectExamplePage extends WizardPage
|
|
|
- implements
|
|
|
|
|
- ExampleWizardConstants,
|
|
|
|
|
- ISelectionChangedListener,
|
|
|
|
|
- SelectionListener,
|
|
|
|
|
- IPropertyChangeListener {
|
|
|
|
|
|
|
+ implements ExampleWizardConstants, ISelectionChangedListener, SelectionListener, IPropertyChangeListener {
|
|
|
|
|
|
|
|
|
|
+ private static final String PRO_BUNDLE = "com.yakindu.sct.domain.c";
|
|
|
|
|
+ private static final String PRO_UPDATE_SITE = "https://info.itemis.com/yakindu/statecharts/pro/";
|
|
|
@Inject
|
|
@Inject
|
|
|
private IExampleService exampleService;
|
|
private IExampleService exampleService;
|
|
|
private TableViewer viewer;
|
|
private TableViewer viewer;
|
|
@@ -98,7 +98,7 @@ public class SelectExamplePage extends WizardPage
|
|
|
container.setLayout(layout);
|
|
container.setLayout(layout);
|
|
|
createTreeViewer(container);
|
|
createTreeViewer(container);
|
|
|
createDetailsPane(container);
|
|
createDetailsPane(container);
|
|
|
- container.setWeights(new int[]{1, 2});
|
|
|
|
|
|
|
+ container.setWeights(new int[] { 1, 2 });
|
|
|
setControl(container);
|
|
setControl(container);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -133,7 +133,7 @@ public class SelectExamplePage extends WizardPage
|
|
|
init(monitor);
|
|
init(monitor);
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if (revealExamplesAutomatically()) {
|
|
if (revealExamplesAutomatically()) {
|
|
|
Display.getCurrent().asyncExec(new Runnable() {
|
|
Display.getCurrent().asyncExec(new Runnable() {
|
|
|
@Override
|
|
@Override
|
|
@@ -159,6 +159,7 @@ public class SelectExamplePage extends WizardPage
|
|
|
});
|
|
});
|
|
|
} else if (!exampleService.isUpToDate(monitor)) {
|
|
} else if (!exampleService.isUpToDate(monitor)) {
|
|
|
Display.getDefault().syncExec(new Runnable() {
|
|
Display.getDefault().syncExec(new Runnable() {
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public void run() {
|
|
public void run() {
|
|
|
setInput(monitor);
|
|
setInput(monitor);
|
|
@@ -174,6 +175,7 @@ public class SelectExamplePage extends WizardPage
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
protected void setInput(final IProgressMonitor monitor) {
|
|
protected void setInput(final IProgressMonitor monitor) {
|
|
@@ -210,7 +212,7 @@ public class SelectExamplePage extends WizardPage
|
|
|
return exampleIdToInstall.equals(((ExampleData) element).getId());
|
|
return exampleIdToInstall.equals(((ExampleData) element).getId());
|
|
|
}
|
|
}
|
|
|
if (element instanceof ExampleContentProvider.Category) {
|
|
if (element instanceof ExampleContentProvider.Category) {
|
|
|
- return ((ExampleContentProvider.Category)element).getChildren().contains(exampleToInstall);
|
|
|
|
|
|
|
+ return ((ExampleContentProvider.Category) element).getChildren().contains(exampleToInstall);
|
|
|
}
|
|
}
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
@@ -232,9 +234,20 @@ public class SelectExamplePage extends WizardPage
|
|
|
setDetailPaneContent(data);
|
|
setDetailPaneContent(data);
|
|
|
setPageComplete(true);
|
|
setPageComplete(true);
|
|
|
setErrorMessage(null);
|
|
setErrorMessage(null);
|
|
|
|
|
+ checkInstalledPlugins(data);
|
|
|
viewer.refresh();
|
|
viewer.refresh();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private void checkInstalledPlugins(ExampleData data) {
|
|
|
|
|
+ if (data.isProfessional() && Platform.getBundle(PRO_BUNDLE) == null) {
|
|
|
|
|
+ messageArea.showProInstall();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ messageArea.hide();
|
|
|
|
|
+ }
|
|
|
|
|
+ messageArea.getParent().layout(true);
|
|
|
|
|
+ this.getControl().update();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
protected void setDetailPaneContent(ExampleData exampleData) {
|
|
protected void setDetailPaneContent(ExampleData exampleData) {
|
|
|
String url = exampleData.getProjectDir().getAbsolutePath() + File.separator + "index.html";
|
|
String url = exampleData.getProjectDir().getAbsolutePath() + File.separator + "index.html";
|
|
|
browser.setUrl(url);
|
|
browser.setUrl(url);
|
|
@@ -260,7 +273,16 @@ public class SelectExamplePage extends WizardPage
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void widgetSelected(SelectionEvent e) {
|
|
public void widgetSelected(SelectionEvent e) {
|
|
|
- revealExamples();
|
|
|
|
|
|
|
+ switch (messageArea.getState()) {
|
|
|
|
|
+ case UPDATE:
|
|
|
|
|
+ revealExamples();
|
|
|
|
|
+ break;
|
|
|
|
|
+ case INSTALL:
|
|
|
|
|
+ Program.launch(PRO_UPDATE_SITE);
|
|
|
|
|
+ break;
|
|
|
|
|
+ default:
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
protected void revealExamples() {
|
|
protected void revealExamples() {
|