-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in Industry THTH ry.\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
- * VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.editors;\r
-\r
-import java.net.URL;\r
-\r
-import org.eclipse.jface.resource.ImageDescriptor;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.ui.IEditorInput;\r
-import org.eclipse.ui.IPersistableElement;\r
-\r
-/**\r
- * EditorInput for the Browser component.\r
- * \r
- * \r
- * @author Marko Luukkainen <Marko.Luukkainen@vtt.fi>\r
- * @author Tuukka Lehtonen\r
- */\r
-public class BrowserInput implements IEditorInput {\r
-\r
- private URL url;\r
- private String name;\r
- private final boolean showControls;\r
- private final boolean fullscreen;\r
- private int browserStyle = SWT.NONE;\r
-\r
- /**\r
- * Creates an input for a browser that has visible controls.\r
- * \r
- * @param url the url that browser opens.\r
- */\r
- public BrowserInput(URL url) {\r
- this.url = url;\r
- this.showControls = true;\r
- this.fullscreen = false;\r
- }\r
-\r
- /**\r
- * Creates an input for a browser that has visible controls.\r
- * \r
- * @param url the url that browser opens.\r
- */\r
- public BrowserInput(URL url, String name) {\r
- this.url = url;\r
- this.showControls = true;\r
- this.fullscreen = false;\r
- }\r
-\r
- /**\r
- * Creates an input for a browser.\r
- * \r
- * @param url the url that browser opens.\r
- * @param showControls visibility flag of controls\r
- */\r
- public BrowserInput(URL url, boolean showControls) {\r
- this.url = url;\r
- this.showControls = showControls;\r
- this.fullscreen = false;\r
- }\r
-\r
- public BrowserInput(URL url, boolean showControls, boolean fullscreen) {\r
- this.url = url;\r
- this.showControls = showControls;\r
- this.fullscreen = fullscreen;\r
- }\r
-\r
- public BrowserInput(URL url, boolean showControls, boolean fullscreen, int style) {\r
- this(url, null, showControls, fullscreen, style);\r
- }\r
-\r
- public BrowserInput(URL url, String name, boolean showControls, boolean fullscreen, int style) {\r
- this.url = url;\r
- this.name = name;\r
- this.showControls = showControls;\r
- this.fullscreen = fullscreen;\r
- this.browserStyle = style;\r
- }\r
-\r
- public void setUrl(URL url) {\r
- this.url = url;\r
- }\r
-\r
- public URL getUrl() {\r
- return url;\r
- }\r
-\r
- public boolean isShowControls() {\r
- return showControls;\r
- }\r
-\r
- @Override\r
- public boolean exists() {\r
- return false;\r
- }\r
-\r
- @Override\r
- public ImageDescriptor getImageDescriptor() {\r
- return null;\r
- }\r
-\r
- public void setName(String name) {\r
- this.name = name;\r
- }\r
-\r
- @Override\r
- public String getName() {\r
- if (name != null)\r
- return name;\r
- return url.toString();\r
- }\r
-\r
- @Override\r
- public IPersistableElement getPersistable() {\r
- return null;\r
- }\r
-\r
- @Override\r
- public String getToolTipText() {\r
- //return getName();\r
- return getUrl().toString();\r
- }\r
-\r
- public boolean isFullscreen() {\r
- return fullscreen;\r
- }\r
-\r
- public int getBrowserStyle() {\r
- return browserStyle;\r
- }\r
-\r
- @SuppressWarnings({ "rawtypes" })\r
- @Override\r
- public Object getAdapter(Class adapter) {\r
- return null;\r
- }\r
-\r
- @Override\r
- public int hashCode() {\r
- final int prime = 31;\r
- int result = 1;\r
- result = prime * result + browserStyle;\r
- result = prime * result + (fullscreen ? 1231 : 1237);\r
- result = prime * result + (showControls ? 1231 : 1237);\r
- result = prime * result + ((url == null) ? 0 : url.hashCode());\r
- return result;\r
- }\r
-\r
- @Override\r
- public boolean equals(Object obj) {\r
- if (this == obj)\r
- return true;\r
- if (obj == null)\r
- return false;\r
- if (getClass() != obj.getClass())\r
- return false;\r
- BrowserInput other = (BrowserInput) obj;\r
- if (browserStyle != other.browserStyle)\r
- return false;\r
- if (fullscreen != other.fullscreen)\r
- return false;\r
- if (showControls != other.showControls)\r
- return false;\r
- if (url == null) {\r
- if (other.url != null)\r
- return false;\r
- } else if (!url.equals(other.url))\r
- return false;\r
- return true;\r
- }\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * 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:
+ * VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.editors;
+
+import java.net.URL;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IPersistableElement;
+
+/**
+ * EditorInput for the Browser component.
+ *
+ *
+ * @author Marko Luukkainen <Marko.Luukkainen@vtt.fi>
+ * @author Tuukka Lehtonen
+ */
+public class BrowserInput implements IEditorInput {
+
+ private URL url;
+ private String name;
+ private final boolean showControls;
+ private final boolean fullscreen;
+ private int browserStyle = SWT.NONE;
+
+ /**
+ * Creates an input for a browser that has visible controls.
+ *
+ * @param url the url that browser opens.
+ */
+ public BrowserInput(URL url) {
+ this.url = url;
+ this.showControls = true;
+ this.fullscreen = false;
+ }
+
+ /**
+ * Creates an input for a browser that has visible controls.
+ *
+ * @param url the url that browser opens.
+ */
+ public BrowserInput(URL url, String name) {
+ this.url = url;
+ this.showControls = true;
+ this.fullscreen = false;
+ }
+
+ /**
+ * Creates an input for a browser.
+ *
+ * @param url the url that browser opens.
+ * @param showControls visibility flag of controls
+ */
+ public BrowserInput(URL url, boolean showControls) {
+ this.url = url;
+ this.showControls = showControls;
+ this.fullscreen = false;
+ }
+
+ public BrowserInput(URL url, boolean showControls, boolean fullscreen) {
+ this.url = url;
+ this.showControls = showControls;
+ this.fullscreen = fullscreen;
+ }
+
+ public BrowserInput(URL url, boolean showControls, boolean fullscreen, int style) {
+ this(url, null, showControls, fullscreen, style);
+ }
+
+ public BrowserInput(URL url, String name, boolean showControls, boolean fullscreen, int style) {
+ this.url = url;
+ this.name = name;
+ this.showControls = showControls;
+ this.fullscreen = fullscreen;
+ this.browserStyle = style;
+ }
+
+ public void setUrl(URL url) {
+ this.url = url;
+ }
+
+ public URL getUrl() {
+ return url;
+ }
+
+ public boolean isShowControls() {
+ return showControls;
+ }
+
+ @Override
+ public boolean exists() {
+ return false;
+ }
+
+ @Override
+ public ImageDescriptor getImageDescriptor() {
+ return null;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String getName() {
+ if (name != null)
+ return name;
+ return url.toString();
+ }
+
+ @Override
+ public IPersistableElement getPersistable() {
+ return null;
+ }
+
+ @Override
+ public String getToolTipText() {
+ //return getName();
+ return getUrl().toString();
+ }
+
+ public boolean isFullscreen() {
+ return fullscreen;
+ }
+
+ public int getBrowserStyle() {
+ return browserStyle;
+ }
+
+ @SuppressWarnings({ "rawtypes" })
+ @Override
+ public Object getAdapter(Class adapter) {
+ return null;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + browserStyle;
+ result = prime * result + (fullscreen ? 1231 : 1237);
+ result = prime * result + (showControls ? 1231 : 1237);
+ result = prime * result + ((url == null) ? 0 : url.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ BrowserInput other = (BrowserInput) obj;
+ if (browserStyle != other.browserStyle)
+ return false;
+ if (fullscreen != other.fullscreen)
+ return false;
+ if (showControls != other.showControls)
+ return false;
+ if (url == null) {
+ if (other.url != null)
+ return false;
+ } else if (!url.equals(other.url))
+ return false;
+ return true;
+ }
+
+}