]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.project/src/org/simantics/project/management/install/SWTInstallAdvisor.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.project / src / org / simantics / project / management / install / SWTInstallAdvisor.java
index 2aec7ae4614228722793d4fe76dfd1530d336048..88e4e7a53a37748c6ead34deced129635d7219a3 100644 (file)
@@ -1,82 +1,82 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2008 IBM Corporation and others.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     IBM Corporation - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.project.management.install;\r
-\r
-import org.eclipse.core.runtime.IStatus;\r
-import org.eclipse.equinox.internal.provisional.p2.installer.IInstallOperation;\r
-import org.eclipse.equinox.internal.provisional.p2.installer.InstallAdvisor;\r
-import org.eclipse.equinox.internal.provisional.p2.installer.InstallDescription;\r
-import org.eclipse.swt.widgets.Display;\r
-\r
-/**\r
- * Install context that creates a simple SWT-based UI and interacts with a user.\r
- */\r
-public class SWTInstallAdvisor extends InstallAdvisor {\r
-       private InstallDialog dialog;\r
-       private boolean started = false;\r
-       private boolean stopped = false;\r
-\r
-       public IStatus performInstall(IInstallOperation operation) {\r
-               return dialog.run(operation);\r
-       }\r
-\r
-       public InstallDescription prepareInstallDescription(InstallDescription description) {\r
-               if (description.getInstallLocation() == null)\r
-                       dialog.promptForLocations(description);\r
-               return description;\r
-       }\r
-\r
-       public boolean promptForLaunch(InstallDescription description) {\r
-               return dialog.promptForLaunch(description);\r
-       }\r
-\r
-       public void setResult(IStatus status) {\r
-               String message;\r
-               if (status.getSeverity() == IStatus.CANCEL) {\r
-                       message = "Canceled";\r
-               } else {\r
-                       message = status.getMessage();\r
-               }\r
-               dialog.promptForClose(message);\r
-       }\r
-\r
-       public synchronized void start() {\r
-               if (stopped || started)\r
-                       return;\r
-               started = true;\r
-               Display display = Display.getCurrent();\r
-               if (display == null)\r
-                       display = new Display();\r
-               dialog = new InstallDialog();\r
-               dialog.setMessage("Preparing");\r
-       }\r
-\r
-       public synchronized void stop() {\r
-               if (stopped || !started)\r
-                       return;\r
-               stopped = true;\r
-               final InstallDialog activeDialog = dialog;\r
-               if (activeDialog == null)\r
-                       return;\r
-               //clear the window now, so the reference is gone no matter what happens during cleanup\r
-               dialog = null;\r
-               final Display display = activeDialog.getDisplay();\r
-               if (display == null || display.isDisposed())\r
-                       return;\r
-               display.syncExec(new Runnable() {\r
-                       public void run() {\r
-                               activeDialog.close();\r
-                       }\r
-               });\r
-               display.dispose();\r
-       }\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.simantics.project.management.install;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.equinox.internal.provisional.p2.installer.IInstallOperation;
+import org.eclipse.equinox.internal.provisional.p2.installer.InstallAdvisor;
+import org.eclipse.equinox.internal.provisional.p2.installer.InstallDescription;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * Install context that creates a simple SWT-based UI and interacts with a user.
+ */
+public class SWTInstallAdvisor extends InstallAdvisor {
+       private InstallDialog dialog;
+       private boolean started = false;
+       private boolean stopped = false;
+
+       public IStatus performInstall(IInstallOperation operation) {
+               return dialog.run(operation);
+       }
+
+       public InstallDescription prepareInstallDescription(InstallDescription description) {
+               if (description.getInstallLocation() == null)
+                       dialog.promptForLocations(description);
+               return description;
+       }
+
+       public boolean promptForLaunch(InstallDescription description) {
+               return dialog.promptForLaunch(description);
+       }
+
+       public void setResult(IStatus status) {
+               String message;
+               if (status.getSeverity() == IStatus.CANCEL) {
+                       message = "Canceled";
+               } else {
+                       message = status.getMessage();
+               }
+               dialog.promptForClose(message);
+       }
+
+       public synchronized void start() {
+               if (stopped || started)
+                       return;
+               started = true;
+               Display display = Display.getCurrent();
+               if (display == null)
+                       display = new Display();
+               dialog = new InstallDialog();
+               dialog.setMessage("Preparing");
+       }
+
+       public synchronized void stop() {
+               if (stopped || !started)
+                       return;
+               stopped = true;
+               final InstallDialog activeDialog = dialog;
+               if (activeDialog == null)
+                       return;
+               //clear the window now, so the reference is gone no matter what happens during cleanup
+               dialog = null;
+               final Display display = activeDialog.getDisplay();
+               if (display == null || display.isDisposed())
+                       return;
+               display.syncExec(new Runnable() {
+                       public void run() {
+                               activeDialog.close();
+                       }
+               });
+               display.dispose();
+       }
+
+}