summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Kriese2011-03-02 05:31:55 (EST)
committerSteffen Kriese2011-03-02 05:31:55 (EST)
commit84f76602cd75580dd4a17fef77120f0da77ef16e (patch)
tree7efcc57bbf9adb41a8c6514e1f14ac31df14d60c
parent4ce8bb3512256fdb22ead57fed3c7757af1ad71b (diff)
downloadorg.eclipse.riena.toolbox-84f76602cd75580dd4a17fef77120f0da77ef16e.zip
org.eclipse.riena.toolbox-84f76602cd75580dd4a17fef77120f0da77ef16e.tar.gz
org.eclipse.riena.toolbox-84f76602cd75580dd4a17fef77120f0da77ef16e.tar.bz2
Previewer: added preference for 'show ridget ids as tooltip'
-rw-r--r--org.eclipse.riena.toolbox.previewer.customizer/Previewer + Customizer.launch2
-rw-r--r--org.eclipse.riena.toolbox.previewer.customizer/src/org/eclipse/riena/toolbox/previewer/customizer/RienaPreviewCustomizer.java23
-rw-r--r--org.eclipse.riena.toolbox.previewer.customizer/src/org/eclipse/riena/toolbox/previewer/customizer/preferences/PreferenceConstants.java1
-rw-r--r--org.eclipse.riena.toolbox.previewer.customizer/src/org/eclipse/riena/toolbox/previewer/customizer/preferences/PreferenceInitializer.java1
-rw-r--r--org.eclipse.riena.toolbox.previewer.customizer/src/org/eclipse/riena/toolbox/previewer/customizer/preferences/PreviewCustomizerPreferencePage.java1
-rw-r--r--org.eclipse.riena.toolbox.previewer/build.properties3
-rw-r--r--org.eclipse.riena.toolbox.previewer/src/org/eclipse/riena/toolbox/previewer/ui/Preview.java129
7 files changed, 88 insertions, 72 deletions
diff --git a/org.eclipse.riena.toolbox.previewer.customizer/Previewer + Customizer.launch b/org.eclipse.riena.toolbox.previewer.customizer/Previewer + Customizer.launch
index 8fbd76b..dc5fe17 100644
--- a/org.eclipse.riena.toolbox.previewer.customizer/Previewer + Customizer.launch
+++ b/org.eclipse.riena.toolbox.previewer.customizer/Previewer + Customizer.launch
@@ -20,7 +20,7 @@
<stringAttribute key="product" value="org.eclipse.platform.ide"/>
<booleanAttribute key="restart" value="false"/>
<stringAttribute key="selected_target_plugins" value="org.eclipse.ui.editors@default:default,org.mortbay.jetty.util@default:default,org.eclipse.core.filesystem.win32.x86@default:false,org.eclipse.ui.console@default:default,org.eclipse.core.filesystem@default:default,org.pluginbuilder.ant.optional.junit@default:false,org.eclipse.ecf.provider.filetransfer@default:default,org.eclipse.ecf@default:default,org.eclipse.update.scheduler@default:default,org.eclipse.pde.launching@default:default,com.instantiations.assist.eclipse.fragment.jdt@default:false,org.eclipse.equinox.p2.updatesite@default:default,org.eclipse.jface.text@default:default,org.eclipse.equinox.jsp.jasper.registry@default:default,org.eclipse.ui.cheatsheets@default:default,org.eclipse.core.databinding@default:default,org.eclipse.cvs@default:default,org.eclipse.core.expressions@default:default,org.eclipse.update.ui@default:default,org.eclipse.jface@default:default,org.apache.commons.logging*1.0.4.v201005080501@default:default,org.eclipse.jdt.debug@default:default,org.eclipse.update.configurator@3:true,org.eclipse.jdt.apt.ui@default:default,org.eclipse.ecf.provider.filetransfer.httpclient@default:default,org.eclipse.equinox.p2.ql@default:default,org.eclipse.platform.doc.user@default:default,org.eclipse.ui.workbench.compatibility@default:false,org.eclipse.osgi.services@default:default,org.apache.commons.codec*1.3.0.v20100106-1700@default:default,org.eclipse.ant.launching@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.equinox.frameworkadmin@default:default,org.eclipse.update.core@default:default,org.eclipse.equinox.simpleconfigurator.manipulator@default:default,org.eclipse.osgi.util@default:default,org.eclipse.ecf.provider.filetransfer.httpclient.ssl@default:false,org.eclipse.ui@default:default,org.eclipse.core.runtime.compatibility@default:default,org.eclipse.ecf.provider.filetransfer.ssl@default:false,org.eclipse.debug.core@default:default,org.eclipse.osgi@-1:true,org.eclipse.equinox.http.registry@default:default,com.instantiations.assist.eclipse.fragment.swt@default:false,org.apache.jasper@default:default,org.eclipse.ui.navigator.resources@default:default,org.apache.lucene@default:default,org.eclipse.pde.ds.ui@default:default,org.apache.commons.el@default:default,org.eclipse.equinox.p2.repository@default:default,org.eclipse.equinox.simpleconfigurator@1:true,com.instantiations.assist.eclipse.fragment.ui.workbench@default:false,org.eclipse.platform.doc.isv@default:default,org.eclipse.ui.forms@default:default,org.eclipse.equinox.security@default:default,org.eclipse.equinox.security.ui@default:default,org.apache.commons.httpclient*3.1.0.v20080605-1935@default:default,org.eclipse.equinox.p2.metadata.generator@default:default,org.eclipse.core.boot@default:default,javax.servlet.jsp@default:default,org.apache.commons.logging*1.0.4.v200904062259@default:default,org.hamcrest.core@default:default,org.eclipse.core.variables@default:default,org.eclipse.equinox.p2.metadata@default:default,org.eclipse.jdt.compiler.tool@default:false,org.eclipse.pde.doc.user@default:default,org.eclipse.ui.externaltools@default:default,org.eclipse.team.ui@default:default,org.eclipse.ui.win32@default:false,org.eclipse.jdt.launching@default:default,org.apache.lucene.analysis@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.core.net.win32.x86@default:false,org.eclipse.ui.ide@default:default,org.eclipse.equinox.security.win32.x86@default:false,org.eclipse.help.webapp@default:default,org.eclipse.equinox.p2.engine@default:default,org.eclipse.ui.ide.application@default:default,org.eclipse.equinox.p2.touchpoint.natives@default:default,org.eclipse.search@default:default,org.eclipse.compare.core@default:default,org.eclipse.jdt.doc.isv@default:default,org.eclipse.equinox.p2.operations@default:default,org.eclipse.ant.core@default:default,org.eclipse.equinox.http.jetty@default:default,org.eclipse.jdt.core.manipulation@default:default,org.eclipse.core.externaltools@default:default,org.eclipse.pde@default:default,org.eclipse.update.core.win32@default:false,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.jsch.ui@default:default,org.mortbay.jetty.server@default:default,org.eclipse.pde.api.tools@default:default,org.eclipse.ui.navigator@default:default,org.eclipse.pde.runtime@default:default,org.eclipse.pde.ds.core@default:default,org.eclipse.ui.presentations.r21@default:default,org.eclipse.equinox.p2.director.app@default:default,org.eclipse.platform@default:default,org.eclipse.equinox.p2.reconciler.dropins@default:default,com.instantiations.assist.eclipse.fragment.ui.workbench.texteditor@default:false,org.junit*3.8.2.v3_8_2_v20100427-1100@default:default,org.eclipse.equinox.p2.console@default:default,org.eclipse.equinox.p2.publisher@default:default,org.eclipse.team.cvs.ssh2@default:default,org.eclipse.ltk.ui.refactoring@default:default,org.eclipse.core.databinding.beans@default:default,org.eclipse.jdt.doc.user@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.pde.ua.core@default:default,com.ibm.icu@default:default,org.eclipse.equinox.p2.extensionlocation@default:default,org.eclipse.equinox.p2.updatechecker@default:default,org.eclipse.jdt.ui@default:default,org.eclipse.equinox.launcher.win32.win32.x86@default:false,org.eclipse.equinox.jsp.jasper@default:default,com.instantiations.assist.eclipse.fragment.jdt.core@default:false,org.eclipse.ui.workbench@default:default,org.eclipse.ui.browser@default:default,org.eclipse.pde.core@default:default,org.eclipse.rcp@default:default,org.eclipse.team.core@default:default,org.eclipse.equinox.util@default:default,org.eclipse.core.commands@default:default,org.eclipse.ui.views@default:default,org.sat4j.core@default:default,org.eclipse.equinox.p2.director@default:default,org.eclipse.equinox.p2.ui.sdk@default:default,org.eclipse.ltk.core.refactoring@default:default,org.eclipse.equinox.concurrent@default:default,org.eclipse.equinox.app@default:default,org.eclipse.pde.junit.runtime@default:default,org.eclipse.equinox.p2.directorywatcher@default:default,org.eclipse.team.cvs.ui@default:default,javax.servlet@default:default,org.eclipse.equinox.p2.ui@default:default,org.eclipse.equinox.p2.jarprocessor@default:default,org.eclipse.core.jobs@default:default,org.eclipse.equinox.p2.artifact.repository@default:default,org.eclipse.jdt.junit@default:default,org.eclipse.ui.intro@default:default,org.eclipse.jdt.core@default:default,org.eclipse.equinox.common@2:true,org.eclipse.ui.net@default:default,org.eclipse.pde.ua.ui@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.core.resources.win32.x86@default:false,org.eclipse.jdt.junit.core@default:default,org.eclipse.help.appserver@default:default,org.eclipse.ui.intro.universal@default:default,org.eclipse.jdt.debug.ui@default:default,com.jcraft.jsch@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.text@default:default,org.eclipse.equinox.p2.core@default:default,org.apache.commons.httpclient*3.1.0.v201005080502@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.equinox.ds@default:true,org.sat4j.pb@default:default,org.eclipse.help@default:default,org.eclipse.jdt@default:default,org.eclipse.team.cvs.core@default:default,org.eclipse.equinox.launcher@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.net4j.jms.api@default:default,org.eclipse.pde.build@default:default,org.eclipse.help.base@default:default,org.eclipse.jdt.junit.runtime@default:default,org.eclipse.ui.workbench.texteditor@default:default,org.eclipse.jdt.compiler.apt@default:false,org.apache.ant@default:default,org.objectweb.asm@default:default,org.eclipse.core.runtime@default:true,org.eclipse.equinox.p2.repository.tools@default:default,org.eclipse.jdt.apt.core@default:default,org.eclipse.core.filebuffers@default:default,com.instantiations.assist.eclipse.fragment.ui.ide@default:false,org.eclipse.equinox.p2.metadata.repository@default:default,org.eclipse.pde.ui@default:default,org.eclipse.jsch.core@default:default,org.eclipse.ant.ui@default:default,org.eclipse.jdt.apt.pluggable.core@default:default,org.eclipse.swt.win32.win32.x86@default:false,org.eclipse.equinox.frameworkadmin.equinox@default:default,org.eclipse.pde.api.tools.ui@default:default,org.eclipse.equinox.p2.ui.sdk.scheduler@default:default,org.apache.commons.codec*1.3.0.v20100518-1140@default:default,org.eclipse.core.resources@default:default,org.eclipse.compare@default:default,org.eclipse.ecf.ssl@default:false,org.eclipse.pde.ui.templates@default:default,org.eclipse.core.net@default:default,org.eclipse.equinox.p2.garbagecollector@default:default,org.eclipse.ui.views.log@default:default,org.eclipse.ui.views.properties.tabbed@default:default,org.apache.commons.logging*1.1.1.v201005080502@default:default,org.eclipse.equinox.p2.touchpoint.eclipse@default:default,org.eclipse.compare.win32@default:default,org.eclipse.swt@default:default,org.eclipse.debug.ui@default:default,org.eclipse.help.ui@default:default"/>
-<stringAttribute key="selected_workspace_plugins" value="org.eclipse.equinox.log@default:default,org.apache.commons.collections@default:default,org.eclipse.riena.ui.filter@default:default,org.eclipse.riena.ui.ridgets@default:default,org.apache.velocity@default:default,org.eclipse.riena.ui.common@default:default,org.eclipse.riena.core@default:default,org.eclipse.riena.ui.core@default:default,org.eclipse.riena.ui.ridgets.swt@default:default,org.jdom@default:default,org.eclipse.riena.toolbox.previewer@default:default,org.apache.oro@default:default,org.eclipse.riena.toolbox.previewer.customizer@default:default,org.eclipse.riena.beans.common@default:default,org.apache.commons.lang@default:default,org.pushingpixels.trident@default:default,org.apache.commons.beanutils@default:default,org.eclipse.riena.ui.swt@default:default"/>
+<stringAttribute key="selected_workspace_plugins" value="org.eclipse.riena.ui.filter@default:default,org.apache.oro@default:default,org.apache.velocity@default:default,org.eclipse.equinox.log@default:default,org.eclipse.riena.ui.ridgets@default:default,org.eclipse.riena.ui.ridgets.swt@default:default,org.apache.commons.collections@default:default,org.eclipse.riena.toolbox.previewer@default:default,org.apache.commons.lang@default:default,org.eclipse.riena.toolbox.previewer.customizer@default:default,org.eclipse.riena.ui.core@default:default,org.eclipse.riena.ui.common@default:default,org.pushingpixels.trident@default:default,org.jdom@default:default,org.eclipse.riena.core@default:default,org.eclipse.riena.ui.swt@default:default,org.eclipse.riena.beans.common@default:default,org.apache.commons.beanutils@default:default"/>
<booleanAttribute key="show_selected_only" value="false"/>
<stringAttribute key="templateConfig" value="${target_home}\configuration\config.ini"/>
<booleanAttribute key="tracing" value="false"/>
diff --git a/org.eclipse.riena.toolbox.previewer.customizer/src/org/eclipse/riena/toolbox/previewer/customizer/RienaPreviewCustomizer.java b/org.eclipse.riena.toolbox.previewer.customizer/src/org/eclipse/riena/toolbox/previewer/customizer/RienaPreviewCustomizer.java
index 0c03914..4736fe1 100644
--- a/org.eclipse.riena.toolbox.previewer.customizer/src/org/eclipse/riena/toolbox/previewer/customizer/RienaPreviewCustomizer.java
+++ b/org.eclipse.riena.toolbox.previewer.customizer/src/org/eclipse/riena/toolbox/previewer/customizer/RienaPreviewCustomizer.java
@@ -1,10 +1,21 @@
package org.eclipse.riena.toolbox.previewer.customizer;
+import org.eclipse.core.commands.Command;
+import org.eclipse.core.commands.State;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.riena.toolbox.previewer.IPreviewCustomizer;
import org.eclipse.riena.toolbox.previewer.customizer.preferences.PreferenceConstants;
+import org.eclipse.riena.toolbox.previewer.customizer.preferences.PreviewCustomizerPreferencePage;
import org.eclipse.riena.ui.swt.lnf.LnfManager;
import org.eclipse.riena.ui.swt.lnf.rienadefault.RienaDefaultLnf;
+import org.eclipse.riena.ui.swt.utils.SWTControlFinder;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.commands.ICommandService;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.handlers.RegistryToggleState;
+import org.eclipse.ui.internal.commands.CommandService;
public class RienaPreviewCustomizer implements IPreviewCustomizer {
@@ -52,6 +63,18 @@ public class RienaPreviewCustomizer implements IPreviewCustomizer {
}
public void afterCreation(Composite parent) {
+ if (!Activator.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.SHOW_RIDGET_IDS)){
+ System.out.println("RienaPreviewCustomizer.afterCreation() show RidgetIds is disabled");
+ return;
+ }
+
+ SWTControlFinder finder = new SWTControlFinder(parent) {
+ @Override
+ public void handleBoundControl(Control control, String bindingProperty) {
+ control.setToolTipText(String.format("RidgetId: '%s'", bindingProperty));
+ }
+ };
+ finder.run();
}
}
diff --git a/org.eclipse.riena.toolbox.previewer.customizer/src/org/eclipse/riena/toolbox/previewer/customizer/preferences/PreferenceConstants.java b/org.eclipse.riena.toolbox.previewer.customizer/src/org/eclipse/riena/toolbox/previewer/customizer/preferences/PreferenceConstants.java
index 9f53e37..23d806c 100644
--- a/org.eclipse.riena.toolbox.previewer.customizer/src/org/eclipse/riena/toolbox/previewer/customizer/preferences/PreferenceConstants.java
+++ b/org.eclipse.riena.toolbox.previewer.customizer/src/org/eclipse/riena/toolbox/previewer/customizer/preferences/PreferenceConstants.java
@@ -6,5 +6,6 @@ package org.eclipse.riena.toolbox.previewer.customizer.preferences;
public class PreferenceConstants {
public static final String LNF_CLASS_NAME = "lnfClassNamePreference";
+ public static final String SHOW_RIDGET_IDS = "showRidgetIdsPreference";
}
diff --git a/org.eclipse.riena.toolbox.previewer.customizer/src/org/eclipse/riena/toolbox/previewer/customizer/preferences/PreferenceInitializer.java b/org.eclipse.riena.toolbox.previewer.customizer/src/org/eclipse/riena/toolbox/previewer/customizer/preferences/PreferenceInitializer.java
index e7f153f..62a6e83 100644
--- a/org.eclipse.riena.toolbox.previewer.customizer/src/org/eclipse/riena/toolbox/previewer/customizer/preferences/PreferenceInitializer.java
+++ b/org.eclipse.riena.toolbox.previewer.customizer/src/org/eclipse/riena/toolbox/previewer/customizer/preferences/PreferenceInitializer.java
@@ -13,6 +13,7 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer {
public void initializeDefaultPreferences() {
IPreferenceStore store = Activator.getDefault().getPreferenceStore();
store.setDefault(PreferenceConstants.LNF_CLASS_NAME, "org.eclipse.riena.ui.swt.lnf.rienadefault.RienaDefaultLnf");
+ store.setDefault(PreferenceConstants.SHOW_RIDGET_IDS, true);
}
}
diff --git a/org.eclipse.riena.toolbox.previewer.customizer/src/org/eclipse/riena/toolbox/previewer/customizer/preferences/PreviewCustomizerPreferencePage.java b/org.eclipse.riena.toolbox.previewer.customizer/src/org/eclipse/riena/toolbox/previewer/customizer/preferences/PreviewCustomizerPreferencePage.java
index 68883c5..1662b31 100644
--- a/org.eclipse.riena.toolbox.previewer.customizer/src/org/eclipse/riena/toolbox/previewer/customizer/preferences/PreviewCustomizerPreferencePage.java
+++ b/org.eclipse.riena.toolbox.previewer.customizer/src/org/eclipse/riena/toolbox/previewer/customizer/preferences/PreviewCustomizerPreferencePage.java
@@ -19,6 +19,7 @@ public class PreviewCustomizerPreferencePage
public void createFieldEditors() {
addField(new StringFieldEditor(PreferenceConstants.LNF_CLASS_NAME, "Look and Feel Classname", getFieldEditorParent()));
+ addField(new BooleanFieldEditor(PreferenceConstants.SHOW_RIDGET_IDS, "Show Ridget Ids as Tooltip", getFieldEditorParent()));
}
public void init(IWorkbench workbench) {
diff --git a/org.eclipse.riena.toolbox.previewer/build.properties b/org.eclipse.riena.toolbox.previewer/build.properties
index cc8f98a..1d0adaf 100644
--- a/org.eclipse.riena.toolbox.previewer/build.properties
+++ b/org.eclipse.riena.toolbox.previewer/build.properties
@@ -4,4 +4,5 @@ bin.includes = META-INF/,\
.,\
plugin.xml,\
bin/,\
- schema/
+ schema/,\
+ icons/
diff --git a/org.eclipse.riena.toolbox.previewer/src/org/eclipse/riena/toolbox/previewer/ui/Preview.java b/org.eclipse.riena.toolbox.previewer/src/org/eclipse/riena/toolbox/previewer/ui/Preview.java
index b42883e..b6c52fc 100644
--- a/org.eclipse.riena.toolbox.previewer/src/org/eclipse/riena/toolbox/previewer/ui/Preview.java
+++ b/org.eclipse.riena.toolbox.previewer/src/org/eclipse/riena/toolbox/previewer/ui/Preview.java
@@ -9,9 +9,6 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.action.ContributionItem;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
@@ -21,14 +18,13 @@ import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.ViewPart;
import org.eclipse.riena.toolbox.previewer.ClassFinder;
import org.eclipse.riena.toolbox.previewer.IPreviewCustomizer;
import org.eclipse.riena.toolbox.previewer.model.ViewPartInfo;
-public class Preview extends ViewPart{
+public class Preview extends ViewPart {
public final static String ID = "org.eclipse.riena.toolbox.previewer.ui.Preview"; //$NON-NLS-1$
private Composite parent;
@@ -40,10 +36,9 @@ public class Preview extends ViewPart{
this.parent = parent;
parent.setLayout(new FillLayout());
setPartName("Previewer");
-
-
+
getViewSite().getActionBars().getToolBarManager().add(new ViewSizeToolBar(parent));
-
+
changeListener = new CompResourceChangeListener(parent.getDisplay());
ResourcesPlugin.getWorkspace().addResourceChangeListener(changeListener, IResourceChangeEvent.POST_CHANGE);
}
@@ -52,40 +47,40 @@ public class Preview extends ViewPart{
updateView(viewPart);
changeListener.setViewPart(viewPart);
}
-
- private class ViewSizeToolBar extends ContributionItem{
-
+
+ private class ViewSizeToolBar extends ContributionItem {
+
private final Composite viewParent;
- public ViewSizeToolBar(Composite viewParent) {
+ public ViewSizeToolBar(final Composite viewParent) {
this.viewParent = viewParent;
}
-
+
@Override
- public void fill(ToolBar parent, int index) {
-
+ public void fill(final ToolBar parent, final int index) {
+
final Text txtSize = createText(parent);
-
- ToolItem toolApply = new ToolItem(parent, SWT.PUSH);
- toolApply.setWidth(60);
- toolApply.setText("Reset");
- toolApply.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- //viewParent.setSize(1024, 768);
- if (getSite().getShell() != PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()){
- Rectangle oldBounds = getSite().getShell().getBounds();
- oldBounds.width = 1024;
- oldBounds.height = 768;
- getSite().getShell().setBounds(oldBounds);
- }
- }
- });
-
+
+ // ToolItem toolApply = new ToolItem(parent, SWT.PUSH);
+ // toolApply.setWidth(60);
+ // toolApply.setText("Reset");
+ // toolApply.addSelectionListener(new SelectionAdapter() {
+ // @Override
+ // public void widgetSelected(SelectionEvent e) {
+ // //viewParent.setSize(1024, 768);
+ // if (getSite().getShell() != PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()){
+ // Rectangle oldBounds = getSite().getShell().getBounds();
+ // oldBounds.width = 1024;
+ // oldBounds.height = 768;
+ // getSite().getShell().setBounds(oldBounds);
+ // }
+ // }
+ // });
+
viewParent.addListener(SWT.Resize, new Listener() {
- public void handleEvent(Event e) {
- txtSize.setText(viewParent.getSize().x+"x"+viewParent.getSize().y); //$NON-NLS-1$
- }
+ public void handleEvent(final Event e) {
+ txtSize.setText(viewParent.getSize().x + "x" + viewParent.getSize().y); //$NON-NLS-1$
+ }
});
}
@@ -93,8 +88,8 @@ public class Preview extends ViewPart{
* @param parent
* @return
*/
- private Text createText(ToolBar parent) {
- ToolItem tool = new ToolItem(parent, SWT.SEPARATOR);
+ private Text createText(final ToolBar parent) {
+ final ToolItem tool = new ToolItem(parent, SWT.SEPARATOR);
final Text text = new Text(parent, SWT.BORDER);
tool.setWidth(80);
text.setEditable(false);
@@ -102,19 +97,17 @@ public class Preview extends ViewPart{
return text;
}
}
-
-
/**
* @param viewPart
*/
private void updateView(final ViewPartInfo viewPart) {
-
- if (parent.isDisposed()){
+
+ if (parent.isDisposed()) {
return;
}
-
- for (Control child : parent.getChildren()) {
+
+ for (final Control child : parent.getChildren()) {
child.dispose();
}
@@ -126,14 +119,12 @@ public class Preview extends ViewPart{
if (!ReflectionUtil.invokeMethod("createPartControl", instance, //$NON-NLS-1$
parent)) {
}
- }
- else {
+ } else {
instance = ReflectionUtil.newInstance(viewPart.getType(), parent);
}
-
-
- IPreviewCustomizer contribution = ClassFinder.getContributedPreviewCustomizer();
- if (null !=contribution){
+
+ final IPreviewCustomizer contribution = ClassFinder.getContributedPreviewCustomizer();
+ if (null != contribution) {
contribution.afterCreation(parent);
}
@@ -141,12 +132,11 @@ public class Preview extends ViewPart{
parent.layout(true);
}
-
@Override
public void setFocus() {
parent.setFocus();
}
-
+
private static class CompilationUnitVisitor implements IResourceDeltaVisitor {
private final ViewPartInfo compilationUnitClassName;
private boolean compilationUnitChanged = false;
@@ -154,21 +144,20 @@ public class Preview extends ViewPart{
/**
* @param receivedTimeStamps
*/
- public CompilationUnitVisitor(ViewPartInfo compilationUnitClassName) {
+ public CompilationUnitVisitor(final ViewPartInfo compilationUnitClassName) {
super();
this.compilationUnitClassName = compilationUnitClassName;
}
public boolean visit(final IResourceDelta delta) throws CoreException {
final IResource res = delta.getResource();
-
if (res.getType() == IResource.FILE) {
- if ((compilationUnitClassName.getType().getSimpleName()+".class").equals(res.getName())) { //$NON-NLS-1$
- compilationUnitChanged = true;
- return false;
- }
- }
+ if ((compilationUnitClassName.getType().getSimpleName() + ".class").equals(res.getName())) { //$NON-NLS-1$
+ compilationUnitChanged = true;
+ return false;
+ }
+ }
return true;
}
@@ -176,39 +165,39 @@ public class Preview extends ViewPart{
return compilationUnitChanged;
}
}
-
+
private class CompResourceChangeListener implements IResourceChangeListener {
-
+
private ViewPartInfo viewPart;
private final Display display;
- public CompResourceChangeListener(Display display) {
+ public CompResourceChangeListener(final Display display) {
this.display = display;
}
-
- public void resourceChanged(IResourceChangeEvent event) {
- if (null == viewPart){
+
+ public void resourceChanged(final IResourceChangeEvent event) {
+ if (null == viewPart) {
return;
}
-
+
final CompilationUnitVisitor pluginXmlVisitor = new CompilationUnitVisitor(viewPart);
-
+
try {
event.getDelta().accept(pluginXmlVisitor);
- if (pluginXmlVisitor.isCompilationUnitChanged()){
+ if (pluginXmlVisitor.isCompilationUnitChanged()) {
display.syncExec(new Runnable() {
public void run() {
updateView(new ClassFinder().loadClass(viewPart.getCompilationUnit()));
}
});
-
+
}
- } catch (CoreException e) {
+ } catch (final CoreException e) {
e.printStackTrace();
}
}
- public void setViewPart(ViewPartInfo viewPart) {
+ public void setViewPart(final ViewPartInfo viewPart) {
this.viewPart = viewPart;
}
}