View | Details | Raw Unified | Return to bug 154781 | Differences between
and this patch

Collapse All | Expand All

(-)plugin.properties (+2 lines)
Lines 1014-1016 Link Here
1014
1014
1015
#--- Work in Progress
1015
#--- Work in Progress
1016
contentAssistAdvancedName= Advanced
1016
contentAssistAdvancedName= Advanced
1017
1018
JavaPropertiesTab=Java
(-)plugin.xml (+26 lines)
Lines 5479-5483 Link Here
5479
	         </selectionEnablement>
5479
	         </selectionEnablement>
5480
      	</linkHelper>          
5480
      	</linkHelper>          
5481
 </extension>
5481
 </extension>
5482
 <extension
5483
       point="org.eclipse.ui.views.properties.tabbed.propertyContributor">
5484
    <propertyContributor
5485
          contributorId="javaEditor"
5486
          structuredSelectionProvider="org.eclipse.jdt.internal.ui.javaeditor.JavaEditor$StructuredSelectionProvider">
5487
       <propertyCategory category="java"/>
5488
    </propertyContributor>
5489
 </extension>
5490
   <extension point="org.eclipse.ui.views.properties.tabbed.propertyTabs">
5491
      <propertyTabs contributorId="javaEditor">
5492
         <propertyTab
5493
            category="java"
5494
               id="javaEditor.JavaTab"
5495
            label="%JavaPropertiesTab"/>
5496
      </propertyTabs>
5497
   </extension>
5498
   <extension point="org.eclipse.ui.views.properties.tabbed.propertySections">
5499
      <propertySections contributorId="javaEditor">
5500
         <propertySection
5501
               class="org.eclipse.ui.views.properties.tabbed.AdvancedPropertySection"
5502
               id="javaEditor.AdvancedSection"
5503
               tab="javaEditor.JavaTab">
5504
            <input type="org.eclipse.jdt.core.IJavaElement"/>
5505
         </propertySection>
5506
      </propertySections>
5507
   </extension>
5482
     
5508
     
5483
</plugin>
5509
</plugin>
(-)META-INF/MANIFEST.MF (-1 / +2 lines)
Lines 127-133 Link Here
127
 org.eclipse.ltk.ui.refactoring;bundle-version="[3.3.0,4.0.0)",
127
 org.eclipse.ltk.ui.refactoring;bundle-version="[3.3.0,4.0.0)",
128
 org.eclipse.ui.forms;bundle-version="[3.2.0,4.0.0)",
128
 org.eclipse.ui.forms;bundle-version="[3.2.0,4.0.0)",
129
 org.eclipse.ui.navigator;bundle-version="[3.2.0,4.0.0)",
129
 org.eclipse.ui.navigator;bundle-version="[3.2.0,4.0.0)",
130
 org.eclipse.jdt.core.manipulation;bundle-version="[1.1.0,2.0.0)"
130
 org.eclipse.jdt.core.manipulation;bundle-version="[1.1.0,2.0.0)",
131
 org.eclipse.ui.views.properties.tabbed;bundle-version="[3.2.0,4.0.0)"
131
Eclipse-LazyStart: true
132
Eclipse-LazyStart: true
132
Plugin-Class: org.eclipse.jdt.internal.ui.JavaPlugin
133
Plugin-Class: org.eclipse.jdt.internal.ui.JavaPlugin
133
Import-Package: com.ibm.icu.text
134
Import-Package: com.ibm.icu.text
(-)ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditor.java (+89 lines)
Lines 33-38 Link Here
33
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
33
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
34
import org.eclipse.core.runtime.preferences.IScopeContext;
34
import org.eclipse.core.runtime.preferences.IScopeContext;
35
35
36
import org.eclipse.core.resources.IFile;
36
import org.eclipse.core.resources.IResource;
37
import org.eclipse.core.resources.IResource;
37
import org.eclipse.core.resources.ProjectScope;
38
import org.eclipse.core.resources.ProjectScope;
38
39
Lines 117-122 Link Here
117
118
118
import org.eclipse.ui.IEditorInput;
119
import org.eclipse.ui.IEditorInput;
119
import org.eclipse.ui.IEditorPart;
120
import org.eclipse.ui.IEditorPart;
121
import org.eclipse.ui.IFileEditorInput;
120
import org.eclipse.ui.IPageLayout;
122
import org.eclipse.ui.IPageLayout;
121
import org.eclipse.ui.IPartListener2;
123
import org.eclipse.ui.IPartListener2;
122
import org.eclipse.ui.IPartService;
124
import org.eclipse.ui.IPartService;
Lines 155-160 Link Here
155
157
156
import org.eclipse.ui.views.contentoutline.ContentOutline;
158
import org.eclipse.ui.views.contentoutline.ContentOutline;
157
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
159
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
160
import org.eclipse.ui.views.properties.IPropertySheetPage;
161
import org.eclipse.ui.views.properties.tabbed.IStructuredSelectionProvider;
162
import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
163
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
158
164
159
import org.eclipse.jdt.core.IClassFile;
165
import org.eclipse.jdt.core.IClassFile;
160
import org.eclipse.jdt.core.ICompilationUnit;
166
import org.eclipse.jdt.core.ICompilationUnit;
Lines 1552-1557 Link Here
1552
		public void partInputChanged(IWorkbenchPartReference partRef) {}
1558
		public void partInputChanged(IWorkbenchPartReference partRef) {}
1553
	}
1559
	}
1554
1560
1561
	public static class StructuredSelectionProvider
1562
		implements IStructuredSelectionProvider
1563
	{
1564
		public IStructuredSelection structuredSelection(ISelection selection) {
1565
			if (selection instanceof IStructuredSelection) {
1566
				return (IStructuredSelection) selection;
1567
			}
1568
			int offset = ((ITextSelection) selection).getOffset();
1569
			
1570
			ICompilationUnit unit = getCompilationUnit();
1571
			IJavaElement javaElement = null;
1572
			if (unit != null) {
1573
				try {
1574
					javaElement = unit.getElementAt(offset);
1575
				} catch (JavaModelException ex) {
1576
					// fall through
1577
				}
1578
			}
1579
			
1580
			if (javaElement == null) {
1581
				return StructuredSelection.EMPTY;
1582
			}
1583
			return new StructuredSelection(javaElement);
1584
		}
1585
		
1586
		private ICompilationUnit getCompilationUnit() {
1587
			IEditorPart editor = getActiveEditor();
1588
			if (editor == null) {
1589
				return null;
1590
			}
1591
			IEditorInput editorInput = editor.getEditorInput();
1592
			if (editorInput instanceof IFileEditorInput) {
1593
				IFileEditorInput fileInput = (IFileEditorInput) editorInput;
1594
				IFile file = fileInput.getFile();
1595
				return JavaCore.createCompilationUnitFrom(file);
1596
			}
1597
			return null;
1598
		}
1599
		
1600
		private IEditorPart getActiveEditor() {
1601
			IWorkbenchWindow activeWorkbenchWindow = JavaPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow();
1602
			if (activeWorkbenchWindow == null) {
1603
				return null;
1604
			}
1605
			IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
1606
			if (activePage == null) {
1607
				return null;
1608
			}
1609
			return activePage.getActiveEditor();
1610
		}
1611
1612
//	
1613
//		public IJpaFile persistenceFileFor(IEditorInput input) {
1614
//			IFile file = null;
1615
//			if (input instanceof IFileEditorInput) {
1616
//				IFileEditorInput fileInput = (IFileEditorInput) input;
1617
//				file = fileInput.getFile();
1618
//			}
1619
//			else if (input instanceof IClassFileEditorInput) {
1620
//				IClassFileEditorInput classFileEditorInput = (IClassFileEditorInput) input;
1621
//				IClassFile classFile = classFileEditorInput.getClassFile();
1622
//				classFile.getResource();
1623
//				
1624
//			}
1625
//			if (file == null) {
1626
//				return null;
1627
//			}
1628
//			return JpaCorePlugin.getJpaFile(file);
1629
//		}
1630
	}
1631
1555
	/** Preference key for matching brackets */
1632
	/** Preference key for matching brackets */
1556
	protected final static String MATCHING_BRACKETS=  PreferenceConstants.EDITOR_MATCHING_BRACKETS;
1633
	protected final static String MATCHING_BRACKETS=  PreferenceConstants.EDITOR_MATCHING_BRACKETS;
1557
	/** Preference key for matching brackets color */
1634
	/** Preference key for matching brackets color */
Lines 2036-2045 Link Here
2036
2113
2037
		if (required == IContextProvider.class)
2114
		if (required == IContextProvider.class)
2038
			return JavaUIHelp.getHelpContextProvider(this, IJavaHelpContextIds.JAVA_EDITOR);
2115
			return JavaUIHelp.getHelpContextProvider(this, IJavaHelpContextIds.JAVA_EDITOR);
2116
		
2117
		if (required == IPropertySheetPage.class) {
2118
			return new TabbedPropertySheetPage(buildTabbedPropertySheetPageContributor());
2119
		}
2039
2120
2040
		return super.getAdapter(required);
2121
		return super.getAdapter(required);
2041
	}
2122
	}
2042
2123
2124
	private ITabbedPropertySheetPageContributor buildTabbedPropertySheetPageContributor() {
2125
		return new ITabbedPropertySheetPageContributor() {
2126
			public String getContributorId() {
2127
				return "javaEditor"; //$NON-NLS-1$
2128
			}
2129
		};
2130
	}
2131
	
2043
	/**
2132
	/**
2044
	 * React to changed selection.
2133
	 * React to changed selection.
2045
	 *
2134
	 *

Return to bug 154781