<comment></comment>
<projects>
<project>net.sourceforge.phpeclipse</project>
+ <project>net.sourceforge.phpeclipse.quantum</project>
+ <project>net.sourceforge.phpeclipse.quantum.sql</project>
</projects>
<buildSpec>
<buildCommand>
PreferencePage.antConsolePreferences = Console
PreferencePage.antRuntimePreferences = Runtime
-Program.externalTools = PHP Program
\ No newline at end of file
+Program.externalTools = PHP Program
+
+OccurrenceAnnotation.label= PHP Marker Occurrences
\ No newline at end of file
<import plugin="org.eclipse.search"/>
<import plugin="org.apache.xerces"/>
<import plugin="org.eclipse.update.ui"/>
+ <import plugin="com.quantum.Quantum"/>
</requires>
<extension
Create a basic PHP file.
</description>
</wizard>
-<!-- choochter's stuff -->
- <wizard
- name="Xaraya Module"
- icon="icons/obj16/php.gif"
- category="net.sourceforge.phpeclipse.wizards.NewWizardCategoryPHP"
- class="com.xaraya.wizard.NewXarayaResourceWizard"
- project="true"
- id="net.sourceforge.phpeclipse.wizards.NewXarayaModuleWizard">
- <description>
- Create a Xaraya module.
- </description>
- </wizard>
</extension>
<extension point="org.eclipse.ui.exportWizards">
<wizard name="%ExportWizards.Obfuscator"
</page> -->
<page
objectClass="org.eclipse.core.resources.IProject"
- name="PHP Obfuscator"
- class="net.sourceforge.phpeclipse.preferences.PHPObfuscatorPropertyPage"
- id="net.sourceforge.phpeclipse.preferences.PHPObfuscatorPropertyPage">
+ name="PHP Project Settings"
+ class="net.sourceforge.phpeclipse.preferences.PHPMiscProjectPreferences"
+ id="net.sourceforge.phpeclipse.preferences.project.PHPMiscProjectPreferences">
<filter
name="nature"
value="net.sourceforge.phpeclipse.phpnature">
</filter>
</page>
+ <page
+ objectClass="org.eclipse.core.resources.IFile"
+ name="PHP File Settings"
+ class="net.sourceforge.phpeclipse.preferences.PHPPreviewProjectPreferences"
+ id="net.sourceforge.phpeclipse.preferences.PHPPreviewProjectPreferences">
+ </page>
</extension>
<!-- <extension
point="org.eclipse.ui.views">
markerSeverity="0">
</type>
<type
- name="org.eclipse.jdt.ui.occurrences">
+ name="net.sourceforge.phpdt.ui.occurrences">
</type>
</extension>
<extension
helpContextId="org.eclipse.ui.bookmark_action_context"
class="org.eclipse.ui.texteditor.BookmarkRulerAction">
</action>
+ <action
+ label="%Dummy.label"
+ class="net.sourceforge.phpeclipse.phpeditor.JavaSelectRulerAction"
+ actionID="RulerClick"
+ id="net.sourceforge.phpeclipse.phpeditor.JavaSelectRulerAction">
+ </action>
</editorContribution>
</extension>
-
+ <extension
+ point="org.eclipse.ui.popupMenus">
+ <viewerContribution
+ targetID="#CompilationUnitRulerContext"
+ id="net.sourceforge.phpeclipse.phpeditor.QuickFixRulerMenuAction">
+ <action
+ label="%Dummy.label"
+ helpContextId="org.eclipse.jdt.ui.quick_fix_action"
+ class="net.sourceforge.phpeclipse.phpeditor.JavaSelectRulerAction"
+ menubarPath="additions"
+ id="net.sourceforge.phpeclipse.phpeditor.JavaSelectRulerMenuAction">
+ </action>
+ </viewerContribution>
+ </extension>
<extension
point="org.eclipse.ui.preferencePages">
<page
id="net.sourceforge.phpeclipse.preference.PHPSyntaxEditorPreferencePage">
</page> -->
<page
+ category="net.sourceforge.phpeclipse.preference.PHPEclipsePreferencePage"
+ name="PHP Project Defaults"
+ class="net.sourceforge.phpeclipse.preferences.PHPMiscProjectPreferences"
+ id="net.sourceforge.phpeclipse.preferences.PHPMiscProjectPreferences">
+ </page>
+ <page
+ category="net.sourceforge.phpeclipse.preference.PHPEclipsePreferencePage"
+ name="PHP Browser Preview"
+ class="net.sourceforge.phpeclipse.preferences.PHPPreviewProjectPreferences"
+ id="net.sourceforge.phpeclipse.preferences.PHPPreviewProjectPreferences">
+ </page>
+ <page
name="Outline"
category="net.sourceforge.phpeclipse.preference.PHPEclipsePreferencePage"
class="net.sourceforge.phpeclipse.PHPOutlinePreferencePage"
class="net.sourceforge.phpdt.internal.ui.preferences.CodeFormatterPreferencePage"
id="net.sourceforge.phpeclipse.preference.CodeFormatterPreferencePage">
</page>
- <page
+ <!-- <page
name="Editor"
category="net.sourceforge.phpeclipse.preference.PHPEclipsePreferencePage"
class="net.sourceforge.phpdt.internal.ui.preferences.PHPEditorPreferencePage"
id="net.sourceforge.phpeclipse.preference.PHPEditorPreferencePage">
+ </page> -->
+ <page
+ name="Editor 2"
+ category="net.sourceforge.phpeclipse.preference.PHPEclipsePreferencePage"
+ class="net.sourceforge.phpdt.internal.ui.preferences.JavaEditorPreferencePage"
+ id="net.sourceforge.phpdt.internal.ui.preferences.JavaEditorPreferencePage">
</page>
<!-- <page
name="Language Settings"
+++ /dev/null
-package com.xaraya.wizard;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.ide.IDE;
-import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard;
-
-public class NewXarayaResourceWizard extends BasicNewResourceWizard {
-
- private XarayaModuleContainerPage mainPage; //get where to place resource and module name
- private XarayaModuleFilePage page1; //get first load of details author/email/which files
-
- private XarayaVersionModel xvm = new XarayaVersionModel(); //holder for details
-
- public NewXarayaResourceWizard() {
- super();
- //initialize static classes that are required..
- new XarayaModuleText();
- new XarayaModuleMessages();
- }
-
- public void addPages() {
- super.addPages();
- mainPage = new XarayaModuleContainerPage(XarayaModuleMessages.getString("Xaraya.label.container"), getSelection());
- addPage(mainPage);
- page1 = new XarayaModuleFilePage(XarayaModuleMessages.getString("Xaraya.label.container"));
- addPage(page1);
- }
-
- public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
- super.init(workbench, currentSelection);
- setWindowTitle(XarayaModuleMessages.getString("Xaraya.label.container"));
- setNeedsProgressMonitor(true);
- }
-
- public boolean performFinish() {
- page1.saveDataToModel();
- IFolder folder = mainPage.createNewModuleFolder(); //create the folder for the module
- if (folder == null)
- return false;
-
- Object[] files = mainPage.createNewModuleFiles(); //create the files
-
- selectAndReveal(folder);
-
- // Open editor on new xaraya init file.
- IWorkbenchWindow dw = getWorkbench().getActiveWorkbenchWindow();
- try {
- IWorkbenchPage page = dw.getActivePage();
- if (page != null)
- IDE.openEditor(page, (IFile) files[0], true);
- } catch (Exception e) {
- }
-
- return true;
- }
-
-}
+++ /dev/null
-package com.xaraya.wizard;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.io.PipedInputStream;
-import java.io.PipedOutputStream;
-import java.io.PrintStream;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.StringTokenizer;
-
-import net.sourceforge.phpdt.internal.ui.util.StringUtil;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceStatus;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.eclipse.ui.dialogs.ContainerGenerator;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
-import org.eclipse.ui.internal.ide.misc.ResourceAndContainerGroup;
-
-public class XarayaModuleContainerPage extends WizardPage implements Listener {
- private static final int SIZING_CONTAINER_GROUP_HEIGHT = 250;
- private IStructuredSelection currentSelection;
- private IContainer currentParent;
- NewXarayaResourceWizard wizard;
- private IPath newModulePath;
- private IFolder newModule;
-
- // widgets
- private ResourceAndContainerGroup resourceGroup;
-
-public XarayaModuleContainerPage(String pageName, IStructuredSelection selection) {
- super(XarayaModuleMessages.getString("Xaraya.label.container"));
- setTitle(pageName);
- setDescription(XarayaModuleMessages.getString("Xaraya.label.container"));
- this.currentSelection = selection;
-}
-
-public void createControl(Composite parent) {
- initializeDialogUnits(parent);
- // top level group
- Composite composite = new Composite(parent,SWT.NONE);
- composite.setFont(parent.getFont());
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(
- GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
-
- WorkbenchHelp.setHelp(composite, IHelpContextIds.NEW_FOLDER_WIZARD_PAGE);
-
- resourceGroup = new ResourceAndContainerGroup(composite,this,
- XarayaModuleMessages.getString("Xaraya.label.container"),
- XarayaModuleMessages.getString("Xaraya.label.modversionname"),
- false, SIZING_CONTAINER_GROUP_HEIGHT); //$NON-NLS-2$ //$NON-NLS-1$
- resourceGroup.setAllowExistingResources(false);
- initializePage();
- validatePage();
- // Show description on opening
- setErrorMessage(null);
- setMessage(null);
- setControl(composite);
-}
-
-protected void createFolder(IFolder folderHandle, IProgressMonitor monitor) throws CoreException {
- try {
- // Create the folder resource in the workspace
- // Update: Recursive to create any folders which do not exist already
- if (!folderHandle.exists()) {
- IContainer parent= folderHandle.getParent();
- if (parent instanceof IFolder && (!((IFolder)parent).exists())) {
- createFolder((IFolder)parent, monitor);
- }
- folderHandle.create(false, true, monitor);
- }
- }
- catch (CoreException e) {
- // If the folder already existed locally, just refresh to get contents
- if (e.getStatus().getCode() == IResourceStatus.PATH_OCCUPIED)
- folderHandle.refreshLocal(IResource.DEPTH_INFINITE, new SubProgressMonitor(monitor, 500));
- else
- throw e;
- }
-
- if (monitor.isCanceled())
- throw new OperationCanceledException();
-}
-
-protected IFolder createFolderHandle(IPath folderPath) {
- return IDEWorkbenchPlugin.getPluginWorkspace().getRoot().getFolder(folderPath);
-}
-
-public IFolder createNewModuleFolder() {
- if (newModule != null)
- return newModule;
-
- // create the new folder and cache it if successful
- final IPath containerPath = resourceGroup.getContainerFullPath();
- newModulePath = containerPath.append(resourceGroup.getResource());
- final IFolder newModuleHandle = createFolderHandle(newModulePath);
-
- WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor monitor) throws CoreException {
- try {
- monitor.beginTask(WorkbenchMessages.getString("WizardNewFolderCreationPage.progress"), 2000); //$NON-NLS-1$
- ContainerGenerator generator = new ContainerGenerator(containerPath);
- generator.generateContainer(new SubProgressMonitor(monitor, 1000));
- createFolder(newModuleHandle, new SubProgressMonitor(monitor, 1000));
- } finally {
- monitor.done();
- }
- }
- };
-
- try {
- getContainer().run(true, true, op);
- } catch (Exception e) {
- return null;
- }
- newModule = newModuleHandle;
- return newModule;
-}
-
-public boolean createNewGuiFolder() {
- final IPath containerPath = newModulePath;
- IPath newFolderPath = containerPath.append(XarayaModuleMessages.getString("Xaraya.folder.gui"));
- final IFolder newFolderHandle = createFolderHandle(newFolderPath);
-
- WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor monitor) throws CoreException {
- try {
- monitor.beginTask(WorkbenchMessages.getString("WizardNewFolderCreationPage.progress"), 2000); //$NON-NLS-1$
- ContainerGenerator generator = new ContainerGenerator(containerPath);
- generator.generateContainer(new SubProgressMonitor(monitor, 1000));
- createFolder(newFolderHandle, new SubProgressMonitor(monitor, 1000));
- } finally {
- monitor.done();
- }
- }
- };
-
- try {
- getContainer().run(true, true, op);
- } catch (Exception e) {
- return false;
- }
- return true;
-}
-
-protected void createFile(IFile fileHandle, InputStream contents, IProgressMonitor monitor) throws CoreException {
- if (contents == null)
- contents = new ByteArrayInputStream(new byte[0]);
-
- try {
- fileHandle.create(contents, false, monitor);
- }
- catch (CoreException e) {
- // If the file already existed locally, just refresh to get contents
- if (e.getStatus().getCode() == IResourceStatus.PATH_OCCUPIED)
- fileHandle.refreshLocal(IResource.DEPTH_ZERO, null);
- else
- throw e;
- }
-
- if (monitor.isCanceled())
- throw new OperationCanceledException();
-}
-
-protected IFile createFileHandle(IPath filePath) {
- return IDEWorkbenchPlugin.getPluginWorkspace().getRoot().getFile(filePath);
-}
-
-public Object[] createNewModuleFiles(){
- ArrayList fileAL = new ArrayList();
- boolean isGuiDirCreated = false;
- fileAL.add(createNewFile(XarayaModuleMessages.getString("Xaraya.files.init")));
- fileAL.add(createNewFile(XarayaModuleMessages.getString("Xaraya.files.version")));
- if (XarayaVersionModel.isAdminApi()) fileAL.add(createNewFile(XarayaModuleMessages.getString("Xaraya.files.adminApi")));
- if (XarayaVersionModel.isAdminGui()) {
- fileAL.add(createNewFile(XarayaModuleMessages.getString("Xaraya.files.adminGui")));
- isGuiDirCreated=createNewGuiFolder();
- }
- if (XarayaVersionModel.isUserApi()) fileAL.add(createNewFile(XarayaModuleMessages.getString("Xaraya.files.userApi")));
- if (XarayaVersionModel.isUserGui()) {
- fileAL.add(createNewFile(XarayaModuleMessages.getString("Xaraya.files.userGui")));
- if (!isGuiDirCreated) isGuiDirCreated=createNewGuiFolder();
- }
- return fileAL.toArray();
-}
-
-public IFile createNewFile(String fileName) {
- final IPath containerPath = newModulePath;
- IPath newFilePath = containerPath.append(fileName);
- final IFile newFileHandle = createFileHandle(newFilePath);
- final InputStream initialContents = getInitialContents(fileName);
- WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
- protected void execute(IProgressMonitor monitor) throws CoreException,
- InterruptedException
- {
- try {
- monitor.beginTask("Progress", 2000); //$NON-NLS-1$
- ContainerGenerator generator = new ContainerGenerator(containerPath);
- generator.generateContainer(new SubProgressMonitor(monitor, 1000));
- createFile(newFileHandle,initialContents, new SubProgressMonitor(monitor, 1000));
- } finally {
- monitor.done();
- }
- }
- };
-
- try {
- getContainer().run(true, true, op);
- } catch (Exception e) {
- return null;
- }
- return newFileHandle;
-}
-
- protected InputStream getInitialContents(String fileName) {
- StringBuffer inputString = new StringBuffer();
- if (fileName.equals(XarayaModuleMessages.getString("Xaraya.files.init")))
- inputString=XarayaModuleText.xarinit;
- if (fileName.equals(XarayaModuleMessages.getString("Xaraya.files.adminGui")))
- inputString=XarayaModuleText.xaradmin;
- if (fileName.equals(XarayaModuleMessages.getString("Xaraya.files.adminApi")))
- inputString=XarayaModuleText.xaradminapi;
- if (fileName.equals(XarayaModuleMessages.getString("Xaraya.files.userGui")))
- inputString=XarayaModuleText.xaruser;
- if (fileName.equals(XarayaModuleMessages.getString("Xaraya.files.userApi")))
- inputString=XarayaModuleText.xaruserapi;
- if (fileName.equals(XarayaModuleMessages.getString("Xaraya.files.version")))
- inputString=XarayaModuleText.xarversion;
-
- ArrayList inserts = new ArrayList();
- //makes things simpler to just refer to the arraylist...
- inserts.add(XarayaModuleMessages.getString("Xaraya.insert.name"));
- inserts.add(XarayaModuleMessages.getString("Xaraya.insert.id"));
- inserts.add(XarayaModuleMessages.getString("Xaraya.insert.version"));
- inserts.add(XarayaModuleMessages.getString("Xaraya.insert.description"));
- inserts.add(XarayaModuleMessages.getString("Xaraya.insert.official"));
- inserts.add(XarayaModuleMessages.getString("Xaraya.insert.author"));
- inserts.add(XarayaModuleMessages.getString("Xaraya.insert.contact"));
- inserts.add(XarayaModuleMessages.getString("Xaraya.insert.admin"));
- inserts.add(XarayaModuleMessages.getString("Xaraya.insert.user"));
- inserts.add(XarayaModuleMessages.getString("Xaraya.insert.securityschema"));
- inserts.add(XarayaModuleMessages.getString("Xaraya.insert.class"));
- inserts.add(XarayaModuleMessages.getString("Xaraya.insert.category"));
-
- ArrayList names = new ArrayList();
- names.add(XarayaVersionModel.getModversionname());
- names.add(XarayaVersionModel.getModversionid());
- names.add(XarayaVersionModel.getModversionversion());
- names.add(XarayaVersionModel.getModversiondescription());
- names.add(XarayaVersionModel.getModversionofficial());
- names.add(XarayaVersionModel.getModversionauthor());
- names.add(XarayaVersionModel.getModversioncontact());
- names.add(XarayaVersionModel.getModversionadmin());
- names.add(XarayaVersionModel.getModversionuser());
- names.add(XarayaVersionModel.getModversionsecurityschema());
- names.add(XarayaVersionModel.getModversionclass());
- names.add(XarayaVersionModel.getModversioncategory());
-
- PipedOutputStream ps = null;
- PipedInputStream is = null;
- String buffer = inputString.toString();
- for (int i=0; i<inserts.size(); i++)
- {
- String insert = (String)inserts.get(i);
- String replace = (String)names.get(i);
-
- buffer = StringUtil.replaceAll(buffer, insert, replace.toLowerCase());
- try {
- ps = new PipedOutputStream();
- is = new PipedInputStream(ps);
- PrintStream os = new PrintStream(ps);
- os.println(buffer);
- os.close();
- } catch (Exception e) {
- System.out.println("writing to file:"+fileName +"failed with:"+ e);
- }
- }
- return is;
- }
-
-
-public void handleEvent(Event ev) {
- setPageComplete(validatePage());
-}
-
-public boolean canFlipToNextPage() {
- return isPageComplete();
-}
-
-protected void initializePage() {
- Iterator enum = currentSelection.iterator();
- if (enum.hasNext()) {
- Object next = enum.next();
- IResource selectedResource = null;
- if (next instanceof IResource) {
- selectedResource = (IResource)next;
- } else if (next instanceof IAdaptable) {
- selectedResource = (IResource)((IAdaptable)next).getAdapter(IResource.class);
- }
- if (selectedResource != null) {
- if (selectedResource.getType() == IResource.FILE)
- selectedResource = selectedResource.getParent();
- if (selectedResource.isAccessible())
- resourceGroup.setContainerFullPath(selectedResource.getFullPath());
- }
- }
- setPageComplete(false);
-}
-
-public void setVisible(boolean visible) {
- super.setVisible(visible);
- if(visible)
- resourceGroup.setFocus();
-}
-
-protected boolean validatePage() {
- boolean valid = true;
- String moduleName = new String();
- IWorkspace workspace = IDEWorkbenchPlugin.getPluginWorkspace();
- IStatus nameStatus = null;
- String folderName = resourceGroup.getResource();
- moduleName = folderName;
- if (folderName.indexOf(IPath.SEPARATOR) != -1) {
- StringTokenizer tok = new StringTokenizer(folderName, String.valueOf(IPath.SEPARATOR));
- while (tok.hasMoreTokens()) {
- String pathFragment = tok.nextToken();
- nameStatus = workspace.validateName(pathFragment, IResource.FOLDER);
- if (!nameStatus.isOK()) {
- break;
- }
- }
- }
- //If the name status was not set validate using the name
- if(nameStatus == null && folderName.length() > 0)
- nameStatus = workspace.validateName(folderName, IResource.FOLDER);
- if (nameStatus != null && !nameStatus.isOK()) {
- setErrorMessage(nameStatus.getMessage());
- return false;
- }
-
- if (!resourceGroup.areAllValuesValid()) {
- // if blank name then fail silently
- if (resourceGroup.getProblemType() == ResourceAndContainerGroup.PROBLEM_RESOURCE_EMPTY
- || resourceGroup.getProblemType() == ResourceAndContainerGroup.PROBLEM_CONTAINER_EMPTY) {
- setMessage(resourceGroup.getProblemMessage());
- setErrorMessage(null);
- } else {
- setErrorMessage(resourceGroup.getProblemMessage());
- }
- valid = false;
- }
- if (valid) {
- XarayaVersionModel.setModversionname(moduleName);
- setErrorMessage(null);
- }
- return valid;
-}
-
-}
-
+++ /dev/null
-package com.xaraya.wizard;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Text;
-
-public class XarayaModuleFilePage extends WizardPage implements Listener
-{
-
- IStructuredSelection selection;
-
- //Xaraya stuff
- private Text modversionid;
- private Text modversionversion;
- private Text modversiondescription;
- private Text modversionofficial;
- private Text modversionauthor;
- private Text modversioncontact;
- private Text modversionsecurityschema;
- private Text modversionclass;
- private Text modversioncategory;
-
- private Button officialButton;
- private Button xarUserApi;
- private Button xarUserGui;
- private Button xarAdminApi;
- private Button xarAdminGui;
-
- public XarayaModuleFilePage(String argument) {
- super(argument);
- setTitle(XarayaModuleMessages.getString("Xaraya.label.module"));
- setDescription(XarayaModuleMessages.getString("Xaraya.label.details"));
- setPageComplete(false);
- }
-
- public void createControl(Composite parent) {
- // create the composite to hold the widgets
- GridData gd;
- Composite composite = new Composite(parent, SWT.NULL);
- // create the desired layout for this wizard page
- GridLayout gl = new GridLayout();
- int ncol = 4;
- gl.numColumns = ncol;
- composite.setLayout(gl);
- Group detailsgrp = new Group(composite, SWT.NULL);
- detailsgrp.setText(XarayaModuleMessages.getString("Xaraya.label.detailsgrp")/*"Module details"*/);
- detailsgrp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- detailsgrp.setLayout(new GridLayout());
-
- new Label (detailsgrp, SWT.NONE).setText(XarayaModuleMessages.getString("Xaraya.label.modversionid")/*"modversionid"*/);
- modversionid = new Text(detailsgrp, SWT.BORDER);
- modversionid.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- modversionid.addListener(SWT.KeyUp, this);
- modversionid.setFocus();
- new Label (detailsgrp, SWT.NONE).setText(XarayaModuleMessages.getString("Xaraya.label.modversionversion")/*"modversionversion"*/);
- modversionversion = new Text(detailsgrp, SWT.BORDER);
- modversionversion.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- modversionversion.addListener(SWT.KeyUp, this);
- new Label (detailsgrp, SWT.NONE).setText(XarayaModuleMessages.getString("Xaraya.label.modversionDescription")/*"modversionDescription"*/);
- modversiondescription = new Text(detailsgrp, SWT.BORDER);
- modversiondescription.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- modversiondescription.addListener(SWT.KeyUp, this);
- // new Label (detailsgrp, SWT.NONE).setText(XarayaModuleMessages.getString("Xaraya.label.modversionofficial")/*"modversionofficial"*/);
- // modversionofficial = new Text(detailsgrp, SWT.BORDER);
- // modversionofficial.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- // modversionofficial.addListener(SWT.KeyUp, this);
- new Label (detailsgrp, SWT.NONE).setText(XarayaModuleMessages.getString("Xaraya.label.modversionauthor")/*"modversionauthor"*/);
- modversionauthor = new Text(detailsgrp, SWT.BORDER);
- modversionauthor.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- modversionauthor.addListener(SWT.KeyUp, this);
- new Label (detailsgrp, SWT.NONE).setText(XarayaModuleMessages.getString("Xaraya.label.modversioncontact")/*"modversioncontact"*/);
- modversioncontact = new Text(detailsgrp, SWT.BORDER);
- modversioncontact.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- modversioncontact.addListener(SWT.KeyUp, this);
- new Label (detailsgrp, SWT.NONE).setText(XarayaModuleMessages.getString("Xaraya.label.modversionsecurityschema")/*"modversionsecurityschema"*/);
- modversionsecurityschema = new Text(detailsgrp, SWT.BORDER);
- modversionsecurityschema.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- modversionsecurityschema.addListener(SWT.KeyUp, this);
- new Label (detailsgrp, SWT.NONE).setText(XarayaModuleMessages.getString("Xaraya.label.modversionclass")/*"modversionclass"*/);
- modversionclass = new Text(detailsgrp, SWT.BORDER);
- modversionclass.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- modversionclass.addListener(SWT.KeyUp, this);
- new Label (detailsgrp, SWT.NONE).setText(XarayaModuleMessages.getString("Xaraya.label.modversioncategory")/*"modversioncategory"*/);
- modversioncategory = new Text(detailsgrp, SWT.BORDER);
- modversioncategory.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- modversioncategory.addListener(SWT.KeyUp, this);
-
- Composite compo = new Composite(composite, SWT.NONE);
- gl = new GridLayout();
- ncol = 1;
- gl.numColumns = ncol;
- compo.setLayout(gl);
-
- //Group officialgrp = new Group(composite, SWT.NONE);
- Group officialgrp = new Group(compo, SWT.NONE);
- officialgrp.setText(XarayaModuleMessages.getString("Xaraya.label.officialgrp")/*"Module details"*/);
- officialgrp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- officialgrp.setLayout(new GridLayout());
-
- officialButton = new Button(officialgrp, SWT.CHECK);
- officialButton.setText(XarayaModuleMessages.getString("Xaraya.label.official"));
- gd = new GridData(GridData.FILL_HORIZONTAL);
- //gd.horizontalSpan = ncol;
- officialButton.setLayoutData(gd);
- officialButton.setSelection(false);
-
- //Group autoGensgrp = new Group(composite, SWT.NONE);
- Group autoGensgrp = new Group(compo, SWT.NONE);
- autoGensgrp.setText(XarayaModuleMessages.getString("Xaraya.label.autoGensgrp"));
- autoGensgrp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- autoGensgrp.setLayout(new GridLayout());
-
- xarUserApi = new Button(autoGensgrp, SWT.CHECK);
- xarUserApi.setText(XarayaModuleMessages.getString("Xaraya.label.xarUserApi"));
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = ncol;
- xarUserApi.setLayoutData(gd);
- xarUserApi.setSelection(false);
- xarUserGui = new Button(autoGensgrp, SWT.CHECK);
- xarUserGui.setText(XarayaModuleMessages.getString("Xaraya.label.xarUserGui"));
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = ncol;
- xarUserGui.setLayoutData(gd);
- xarUserGui.setSelection(false);
- xarAdminApi = new Button(autoGensgrp, SWT.CHECK);
- xarAdminApi.setText(XarayaModuleMessages.getString("Xaraya.label.xarAdminApi"));
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = ncol;
- xarAdminApi.setLayoutData(gd);
- xarAdminApi.setSelection(false);
- xarAdminGui = new Button(autoGensgrp, SWT.CHECK);
- xarAdminGui.setText(XarayaModuleMessages.getString("Xaraya.label.xarAdminGui"));
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = ncol;
- xarAdminGui.setLayoutData(gd);
- xarAdminGui.setSelection(false);
-
- // set the composite as the control for this page
- setControl(composite);
- addListeners();
- }
-
- private void addListeners()
- {
- officialButton.addListener(SWT.Selection, this);
- xarUserApi.addListener(SWT.Selection, this);
- xarUserGui.addListener(SWT.Selection, this);
- xarAdminApi.addListener(SWT.Selection, this);
- xarAdminGui.addListener(SWT.Selection, this);
- }
-
- public void handleEvent(Event event) {
- setPageComplete(validatePage());
- }
-
-// public boolean canFlipToNextPage()
-// {
-// if (getErrorMessage() != null) return false;
-// if (isPageComplete() && validatePage()) {
-// saveDataToModel();
-// return true;
-// }
-// return false;
-// }
- public boolean canFinish(){
- if (isPageComplete() /*&& validatePage()*/) {
- saveDataToModel();
- return true;
- }
- return false;
- }
-
-
-
- private boolean validateText(Text input){
- String buf = input.getText();
- if ((buf!=null)
- && (buf.trim().length() >0)) return true;
- else return false;
- }
- public boolean isNumeric(Text input) {
- //there is something in the field to check..
- StringBuffer buf = new StringBuffer(input.getText());
- for (int i=0; i < buf.length(); i++){
- if (!( Character.isDigit(buf.charAt(i)) //is it a number
- || (buf.charAt(i) == '.') //is it a decimal point
- || (buf.charAt(i) == '_'))) //is it an under_score (incase of 1_2)
- return false;
- }
- return true;
- }
-
- private boolean validatePage() {
- StringBuffer buf = new StringBuffer();
- if (!validateText(modversionid)) buf.append("Id field incomplete");
- else if (!isNumeric(modversionid)) buf.append("Id field must be numeric");
- else if (!validateText(modversionversion)) buf.append("Version field incomplete");
- else if (!isNumeric(modversionversion)) buf.append("Version must be numeric");
- else if (!validateText(modversiondescription)) buf.append("Description field incomplete");
- else if (!validateText(modversionauthor)) buf.append("Author field incomplete");
- else if (!validateText(modversioncontact)) buf.append("Contact field incomplete");
- else if (!validateText(modversionsecurityschema)) buf.append("Security schema field incomplete");
- else if (!validateText(modversionclass)) buf.append("Class field incomplete");
- else if (!validateText(modversioncategory)) buf.append("Category field incomplete");
- if (buf.length() == 0) {
- //setErrorMessage("Module ready for creation");
- setErrorMessage(null);
- return true;
- }
- setErrorMessage(buf.toString());
- return false;
- }
-
- public void saveDataToModel()
- {
- XarayaVersionModel.setModversionid(modversionid.getText());
- XarayaVersionModel.setModversionversion(modversionversion.getText());
- XarayaVersionModel.setModversiondescription(modversiondescription.getText());
- XarayaVersionModel.setModversionauthor(modversionauthor.getText());
- XarayaVersionModel.setModversioncontact(modversioncontact.getText());
- XarayaVersionModel.setModversionsecurityschema(modversionsecurityschema.getText());
- XarayaVersionModel.setModversionclass(modversionclass.getText());
- XarayaVersionModel.setModversioncategory(modversioncategory.getText());
- XarayaVersionModel.setUserApi(xarUserApi.getSelection());
- XarayaVersionModel.setUserGui(xarUserGui.getSelection());
- XarayaVersionModel.setAdminApi(xarAdminApi.getSelection());
- XarayaVersionModel.setAdminGui(xarAdminGui.getSelection());
- XarayaVersionModel.setModversionofficial(
- (officialButton.getSelection()) ? "1" : "0");
- XarayaVersionModel.setModversionadmin(
- (xarAdminGui.getSelection()) ? "1" : "0" );
- XarayaVersionModel.setModversionuser(
- (xarUserGui.getSelection()) ? "1" : "0" );
- }
-}
-
+++ /dev/null
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-package com.xaraya.wizard;
-
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-public class XarayaModuleMessages {
-
- private static final String RESOURCE_BUNDLE= XarayaModuleMessages.class.getName();
- private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
-
- protected XarayaModuleMessages() {
- }
-
- public static String getString(String key) {
- try {
- return fgResourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return '!' + key + '!';
- }
- }
-
- /**
- * Gets a string from the resource bundle and formats it with the argument
- *
- * @param key the string used to get the bundle value, must not be null
- */
- public static String getFormattedString(String key, Object arg) {
- return MessageFormat.format(getString(key), new Object[] { arg });
- }
-
-
- /**
- * Gets a string from the resource bundle and formats it with arguments
- */
- public static String getFormattedString(String key, Object[] args) {
- return MessageFormat.format(getString(key), args);
- }
-}
+++ /dev/null
-########################################
-#Constants for use in the xaraya wizard#
-########################################
-
-#Xaraya files
-Xaraya.files.init=xarinit.php
-Xaraya.files.version=xarversion.php
-Xaraya.files.userGui=xaruser.php
-Xaraya.files.userApi=xaruserapi.php
-Xaraya.files.adminGui=xaradmin.php
-Xaraya.files.adminApi=xaradminapi.php
-Xaraya.folder.gui=xartemplates
-
-#Xaraya inserts for replacement
-Xaraya.insert.name=<modname>
-Xaraya.insert.id=<id number>
-Xaraya.insert.version=<version>
-Xaraya.insert.description=<description>
-Xaraya.insert.official=<official>
-Xaraya.insert.author=<author name>
-Xaraya.insert.contact=<author email>
-Xaraya.insert.admin=<admin>
-Xaraya.insert.user=<user>
-Xaraya.insert.securityschema=<security schema>
-Xaraya.insert.class=<classification>
-Xaraya.insert.category=<category>
-Xaraya.insert.help=<help>
-Xaraya.insert.changelog=<changelog>
-Xaraya.insert.credits=<credits>
-Xaraya.insert.license=<license>
-
-#Xaraya label texts
-Xaraya.label.container=New Xaraya Module
-Xaraya.label.module=Create Xaraya module
-Xaraya.label.details=Enter module details
-Xaraya.label.modversionname=Module Name
-Xaraya.label.modversionid=Id number
-Xaraya.label.modversionversion=Module version
-Xaraya.label.modversionDescription=Description
-Xaraya.label.modversionofficial=Official
-Xaraya.label.modversionauthor=Author
-Xaraya.label.modversioncontact=Contact e-mail
-Xaraya.label.modversionsecurityschema=Security schema
-Xaraya.label.modversionclass=Classification
-Xaraya.label.modversioncategory=Category
-Xaraya.label.modversionhelp=Help
-Xaraya.label.modversionchangelog=Change log
-Xaraya.label.modversioncredits=Credits
-Xaraya.label.modversionlicense=License
-Xaraya.label.detailsgrp=Module details
-Xaraya.label.autoGensgrp=Select files to create
-Xaraya.label.officialgrp=Official module settings
-Xaraya.label.official=Official module?
-Xaraya.label.xarUserApi=User api (xarUserApi.php)
-Xaraya.label.xarUserGui=User gui (xarUser.php)
-Xaraya.label.xarAdminApi=Admin api(xarAdminApi.php)
-Xaraya.label.xarAdminGui=Admin gui (xarAdmin.php)
-
-
+++ /dev/null
-package com.xaraya.wizard;
-
-public final class XarayaModuleText {
- final static StringBuffer xarinit = new StringBuffer(
- "<?php\n" +
- "/**\n" +
- " * File: $Id: XarayaModuleText.java,v 1.1 2003-02-04 22:23:09 choochter Exp $\n" +
- " * \n" +
- " * Initialise <modname> Module\n" +
- " *\n" +
- " * @package Xaraya eXtensible Management System\n" +
- " * @copyright (C) 2002 by the Xaraya Development Team.\n" +
- " * @license GPL <http://www.gnu.org/licenses/gpl.html>\n" +
- " * @link http://www.xaraya.org\n" +
- " *\n" +
- " * @subpackage <modname> Module\n" +
- " * @author <author name> <<author email>>\n" +
- " */\n" +
- "\n" +
- "/**\n" +
- " * initialise the <modname> module\n" +
- " *\n" +
- " * @access public\n" +
- " * @param none\n" +
- " * @returns bool\n" +
- " * @raise DATABASE_ERROR\n" +
- " */\n" +
- "function <modname>_init()\n" +
- "{\n" +
- " return true;\n" +
- "}\n" +
- "\n" +
- "/** \n" +
- " * upgrade the <modname> module from an old version\n" +
- " * \n" +
- " * @access public\n" +
- " * @param oldversion float \"Previous version upgrading from\"\n" +
- " * @returns bool\n" +
- " * @raise DATABASE_ERROR\n" +
- " */ \n" +
- "function <modname>_upgrade($oldversion)\n" +
- "{\n" +
- " return true;\n" +
- "}\n" +
- "\n" +
- "/**\n" +
- " * remove the <modname> module\n" +
- " *\n" +
- " * @access public\n" +
- " * @param none\n" +
- " * @returns bool\n" +
- " * @raise DATABASE_ERROR\n" +
- " */\n" +
- "function <modname>_delete()\n" +
- "{\n" +
- " return true;\n" +
- "}\n" +
- "?>");
-
- final static StringBuffer xaradmin = new StringBuffer(
- "<?php\n" +
- "/**\n" +
- " * File: $Id: XarayaModuleText.java,v 1.1 2003-02-04 22:23:09 choochter Exp $\n" +
- " * \n" +
- " * <modname> Admin Interface\n" +
- " *\n" +
- " * @package Xaraya eXtensible Management System\n" +
- " * @copyright (C) 2002 by the Xaraya Development Team.\n" +
- " * @license GPL <http://www.gnu.org/licenses/gpl.html>\n" +
- " * @link http://www.xaraya.org\n" +
- " *\n" +
- " * @subpackage <modname> Module\n" +
- " * @author <author name> <<author email>>\n" +
- " */\n" +
- "\n" +
- "?>\n"
- );
-
- final static StringBuffer xaradminapi = new StringBuffer(
- "<?php\n" +
- "/**\n" +
- " * File: $Id: XarayaModuleText.java,v 1.1 2003-02-04 22:23:09 choochter Exp $\n" +
- " * \n" +
- " * <modname> Admin API\n" +
- " *\n" +
- " * @package Xaraya eXtensible Management System\n" +
- " * @copyright (C) 2002 by the Xaraya Development Team.\n" +
- " * @license GPL <http://www.gnu.org/licenses/gpl.html>\n" +
- " * @link http://www.xaraya.org\n" +
- " *\n" +
- " * @subpackage <modname> Module\n" +
- " * @author <author name> <<author email>>\n" +
- " */\n" +
- "\n" +
- "?>\n"
- );
-
-
- final static StringBuffer xaruser = new StringBuffer(
- "<?php\n" +
- "/**\n" +
- " * File: $Id: XarayaModuleText.java,v 1.1 2003-02-04 22:23:09 choochter Exp $\n" +
- " * \n" +
- " * <modname> User Interface\n" +
- " *\n" +
- " * @package Xaraya eXtensible Management System\n" +
- " * @copyright (C) 2002 by the Xaraya Development Team.\n" +
- " * @license GPL <http://www.gnu.org/licenses/gpl.html>\n" +
- " * @link http://www.xaraya.org\n" +
- " *\n" +
- " * @subpackage <modname> Module\n" +
- " * @author <author name> <<author email>>\n" +
- " */\n" +
- "\n" +
- "?>\n"
- );
-
- final static StringBuffer xaruserapi = new StringBuffer(
- "<?php\n" +
- "/**\n" +
- " * File: $Id: XarayaModuleText.java,v 1.1 2003-02-04 22:23:09 choochter Exp $\n" +
- " * \n" +
- " * <modname> User API\n" +
- " *\n" +
- " * @package Xaraya eXtensible Management System\n" +
- " * @copyright (C) 2002 by the Xaraya Development Team.\n" +
- " * @license GPL <http://www.gnu.org/licenses/gpl.html>\n" +
- " * @link http://www.xaraya.org\n" +
- " *\n" +
- " * @subpackage <modname> Module\n" +
- " * @author <author name> <<author email>>\n" +
- " */\n" +
- "\n" +
- "?>\n"
- );
-
- final static StringBuffer xarversion = new StringBuffer(
- "<?php\n" +
- "$modversion['name'] = '<modname>';\n" +
- "$modversion['id'] = '<id number>';\n" +
- "$modversion['version'] = '<version>';\n" +
- "$modversion['description'] = '<description>';\n" +
- "$modversion['official'] = <official>;\n" +
- "$modversion['author'] = '<author name>';\n" +
- "$modversion['contact'] = '<author email>';\n" +
- "$modversion['admin'] = <admin>;\n" +
- "$modversion['user'] = <user>;\n" +
- "$modversion['securityschema'] = array('<modname>::' => '::');\n" +
- "$modversion['class'] = '<classification>';\n" +
- "$modversion['category'] = '<category>';\n" +
- "?>\n"
- );
-}
+++ /dev/null
-package com.xaraya.wizard;
-
-
-/**
- * Class to hold the details of a xarya module so the
- * filecreation process can be performed
-*/
-public final class XarayaVersionModel
-{
- //Fields to hold the details of the project to write
- //in the xarVersions.php file..
- private static String modversionname; //compulsory
- private static String modversiondescription; //compulsory
- private static String modversionid; //compulsory
- private static String modversionversion; //compulsory
- private static String modversioncredits;
- private static String modversionhelp;
- private static String modversionchangelog;
- private static String modversionlicense;
- private static String modversioncoding;
- private static String modversionofficial; //compulsory
- private static String modversionauthor; //compulsory
- private static String modversioncontact; //compulsory
- private static String modversionadmin; //compulsory
- private static String modversionuser; //compulsory
- private static String modversionsecurityschema; //compulsory
- private static String modversionclass; //compulsory
- private static String modversioncategory; //compulsory
-
- public static boolean /*modversionofficial,*/userApi, userGui, adminApi, adminGui;
-
-
-//Getters and setters for xaraya specifics
- public static String getModversiondescription() { return modversiondescription; }
- public static String getModversionname() { return modversionname; }
- public static String getModversionadmin() { return modversionadmin;}
- public static String getModversionauthor() { return modversionauthor;}
- public static String getModversioncategory() { return modversioncategory;}
- public static String getModversionchangelog() {return modversionchangelog;}
- public static String getModversionclass() {return modversionclass;}
- public static String getModversioncontact() {return modversioncontact;}
- public static String getModversioncredits() {return modversioncredits;}
- public static String getModversionhelp() {return modversionhelp;}
- public static String getModversionid() {return modversionid;}
- public static String getModversionlicense() {return modversionlicense;}
- public static String getModversioncoding() {return modversioncoding;}
- public static String getModversionofficial() {return modversionofficial;}
- public static String getModversionsecurityschema() {return modversionsecurityschema;}
- public static String getModversionuser() {return modversionuser;}
- public static String getModversionversion() {return modversionversion;}
- public static void setModversiondescription(String mvd) { XarayaVersionModel.modversiondescription = mvd; }
- public static void setModversionname(String mvn) { XarayaVersionModel.modversionname = mvn; }
- public static void setModversionadmin(String mva) {XarayaVersionModel.modversionadmin = mva;}
- public static void setModversionauthor(String mva) {XarayaVersionModel.modversionauthor = mva;}
- public static void setModversioncategory(String mvc) {XarayaVersionModel.modversioncategory = mvc;}
- public static void setModversionchangelog(String mvc) {XarayaVersionModel.modversionchangelog = mvc;}
- public static void setModversionclass(String mvc) {XarayaVersionModel.modversionclass = mvc;}
- public static void setModversioncontact(String mvc) {XarayaVersionModel.modversioncontact = mvc;}
- public static void setModversioncredits(String mvc) {XarayaVersionModel.modversioncredits = mvc;}
- public static void setModversionhelp(String mvh) {XarayaVersionModel.modversionhelp = mvh;}
- public static void setModversionid(String mvid) {XarayaVersionModel.modversionid = mvid;}
- public static void setModversionlicense(String mvl) {XarayaVersionModel.modversionlicense = mvl;}
- public static void setModversioncoding(String mvl) {XarayaVersionModel.modversioncoding = mvl;}
- public static void setModversionofficial(String mvo) {XarayaVersionModel.modversionofficial = mvo;}
- public static void setModversionsecurityschema(String mvss) {XarayaVersionModel.modversionsecurityschema = mvss;}
- public static void setModversionuser(String mvu) {XarayaVersionModel.modversionuser = mvu;}
- public static void setModversionversion(String mvv) {XarayaVersionModel.modversionversion = mvv;}
-
- //public static boolean isOfficial() { return modversionofficial; }
- public static boolean isAdminApi() { return adminApi; }
- public static boolean isAdminGui() { return adminGui; }
- public static boolean isUserApi() { return userApi; }
- public static boolean isUserGui() { return userGui; }
- //public static void setOfficial(boolean official) { XarayaVersionModel.modversionofficial = official; }
- public static void setAdminApi(boolean adminApi) { XarayaVersionModel.adminApi = adminApi;}
- public static void setAdminGui(boolean adminGui) { XarayaVersionModel.adminGui = adminGui; }
- public static void setUserApi(boolean userApi) { XarayaVersionModel.userApi = userApi; }
- public static void setUserGui(boolean userGui) { XarayaVersionModel.userGui = userGui; }
-}
/**********************************************************************
-Copyright (c) 2002 IBM Corp. and others.
-All rights reserved. Â This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-Â
-Contributors:
- IBM Corporation - initial API and implementation
-**********************************************************************/
-
+ Copyright (c) 2002 IBM Corp. and others.
+ All rights reserved. Â This program and the accompanying materials
+ are made available under the terms of the Common Public License v0.5
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/cpl-v05.html
+ Â
+ Contributors:
+ IBM Corporation - initial API and implementation
+ **********************************************************************/
package net.sourceforge.phpdt.core.compiler;
-
/**
- * Maps each terminal symbol in the php-grammar into a unique integer.
- * This integer is used to represent the terminal when computing a parsing
- * action.
+ * Maps each terminal symbol in the php-grammar into a unique integer. This
+ * integer is used to represent the terminal when computing a parsing action.
*
* @see IScanner
* @since 2.0
*/
public interface ITerminalSymbols {
-
- public final static String[] PHP_TYPES =
- {
- "array",
- "string",
- "object",
- "bool",
- "boolean",
- "real",
- "double",
- "float",
- "int",
- "integer",
- };
- //"array",
+ public final static String[] PHP_TYPES = {"array", "string", "object",
+ "bool", "boolean", "real", "double", "float", "int", "integer",};
+ //"array",
public final static int TokenNameWHITESPACE = 900,
- TokenNameCOMMENT_LINE = 901,
- TokenNameCOMMENT_BLOCK = 902,
- TokenNameCOMMENT_PHPDOC = 903;
-// TokenNameHTML = 904;
-
+ TokenNameCOMMENT_LINE = 901, TokenNameCOMMENT_BLOCK = 902,
+ TokenNameCOMMENT_PHPDOC = 903;
+ // TokenNameHTML = 904;
final static int TokenNameEOF = 0;
final static int TokenNameERROR = 1;
final static int TokenNameINLINE_HTML = 2;
-
final static int TokenNameREMAINDER = 30;
final static int TokenNameNOT = 31;
final static int TokenNameDOT = 32;
final static int TokenNameOR_OR = 45;
final static int TokenNameCOLON = 47;
final static int TokenNameDOT_EQUAL = 48;
-
final static int TokenNameEQUAL = 49;
final static int TokenNameMINUS_GREATER = 50; // ->
final static int TokenNameEQUAL_GREATER = 51; // => (for each operator)
final static int TokenNameQUESTION = 62;
final static int TokenNamePAAMAYIM_NEKUDOTAYIM = 63;
final static int TokenNameAT = 64;
-
final static int TokenNameand = 65;
final static int TokenNameor = 66;
final static int TokenNamexor = 67;
-
final static int TokenNameDOLLAR = 126;
-// final static int TokenNameDOLLAR_LBRACE = 127;
+ final static int TokenNameDOLLAR_LBRACE = 127;
final static int TokenNameLPAREN = 128;
final static int TokenNameRPAREN = 129;
final static int TokenNameLBRACE = 130;
final static int TokenNameLBRACKET = 132;
final static int TokenNameRBRACKET = 133;
final static int TokenNameCOMMA = 134;
-
final static int TokenNameStringLiteral = 136;
final static int TokenNameIdentifier = 138;
final static int TokenNameSEMICOLON = 140;
final static int TokenNameDoubleLiteral = 152;
final static int TokenNameStringInterpolated = 153;
final static int TokenNameStringConstant = 154;
-
final static int TokenNameLEFT_SHIFT = 155;
final static int TokenNameRIGHT_SHIFT = 156;
final static int TokenNameEQUAL_EQUAL_EQUAL = 157;
final static int TokenNameNOT_EQUAL_EQUAL = 158;
-
final static int TokenNameOR = 160;
final static int TokenNameHEREDOC = 161;
-
final static int TokenNameintCAST = 174;
final static int TokenNameboolCAST = 175;
final static int TokenNamedoubleCAST = 176;
final static int TokenNameobjectCAST = 179;
final static int TokenNameunsetCAST = 180;
+ // ´
+ final static int TokenNameEncapsedString0 = 190;
+ // '
+ final static int TokenNameEncapsedString1 = 191;
+ // "
+ final static int TokenNameEncapsedString2 = 192;
+
+ final static int TokenNameSTRING = 193;
+
+ final static int TokenNameCURLY_OPEN = 194;
+ // start SQL token - the SQL tokens are only used in the
+ // PHPCompletionprocessor:
+ public final static int TokenNameSQLselect = 901;
+ public final static int TokenNameSQLupdate = 902;
+ public final static int TokenNameSQLinsert = 903;
+ public final static int TokenNameSQLwhere = 904;
+ public final static int TokenNameSQLfrom = 905;
+ public final static int TokenNameSQLinto = 906;
+ public final static int TokenNameSQLset = 907;
+ public final static int TokenNameSQLvalues = 908;
+ // stop SQL token
public final static int TokenNameKEYWORD = 1000;
public final static int TokenNameif = 1001;
public final static int TokenNameelseif = 1002;
public final static int TokenNamebreak = 1012;
public final static int TokenNamecontinue = 1013;
public final static int TokenNamereturn = 1014;
-// public final static int TokenNamedefine = 1015;
+ // public final static int TokenNamedefine = 1015;
public final static int TokenNameinclude = 1016;
public final static int TokenNameinclude_once = 1017;
public final static int TokenNamerequire = 1018;
public final static int TokenNameprint = 1036;
public final static int TokenNameunset = 1037;
public final static int TokenNameexit = 1038;
-// public final static int TokenNamedie = 1039;
+ // public final static int TokenNamedie = 1039;
// public final static int TokenNameand = 1040;
// public final static int TokenNameor = 1041;
// public final static int TokenNamexor = 1042;
public final static int TokenNamelist = 1043;
-// public final static int TokenNamenull = 1044;
-// public final static int TokenNamefalse = 1045;
-// public final static int TokenNametrue = 1046;
-// public final static int TokenNamethis = 1047;
- //
- public final static int TokenNameabstract = 1050;
- public final static int TokenNamecatch = 1051;
- public final static int TokenNamefinally = 1052;
- public final static int TokenNametry = 1053;
- public final static int TokenNameprivate = 1054;
- public final static int TokenNameprotected = 1055;
- public final static int TokenNamepublic = 1056;
- public final static int TokenNameinterface = 1057;
- public final static int TokenNameimplements = 1058;
- public final static int TokenNameinstanceof = 1059;
- public final static int TokenNamesuper = 1060;
- public final static int TokenNamethrow = 1061;
-
- public final static int TokenNameconst = 1062;
- public final static int TokenNameclone = 1063;
- public final static int TokenNamedeclare = 1064;
- public final static int TokenNameenddeclare = 1065;
- public final static int TokenNameeval = 1065;
- public final static int TokenNameuse = 1066;
- public final static int TokenNameisset = 1066;
- public final static int TokenNamefinal = 1067;
-
- public final static int TokenNameLINE = 1070;
- public final static int TokenNameFILE = 1071;
- public final static int TokenNameCLASS_C = 1072;
- public final static int TokenNameMETHOD_C = 1073;
- public final static int TokenNameFUNC_C = 1074;
+ // public final static int TokenNamenull = 1044;
+ // public final static int TokenNamefalse = 1045;
+ // public final static int TokenNametrue = 1046;
+ // public final static int TokenNamethis = 1047;
+ //
+ public final static int TokenNameabstract = 1050;
+ public final static int TokenNamecatch = 1051;
+ public final static int TokenNamefinally = 1052;
+ public final static int TokenNametry = 1053;
+ public final static int TokenNameprivate = 1054;
+ public final static int TokenNameprotected = 1055;
+ public final static int TokenNamepublic = 1056;
+ public final static int TokenNameinterface = 1057;
+ public final static int TokenNameimplements = 1058;
+ public final static int TokenNameinstanceof = 1059;
+ public final static int TokenNamesuper = 1060;
+ public final static int TokenNamethrow = 1061;
+ public final static int TokenNameconst = 1062;
+ public final static int TokenNameclone = 1063;
+ public final static int TokenNamedeclare = 1064;
+ public final static int TokenNameenddeclare = 1065;
+ public final static int TokenNameeval = 1065;
+ public final static int TokenNameuse = 1066;
+ public final static int TokenNameisset = 1066;
+ public final static int TokenNamefinal = 1067;
+ public final static int TokenNameLINE = 1070;
+ public final static int TokenNameFILE = 1071;
+ public final static int TokenNameCLASS_C = 1072;
+ public final static int TokenNameMETHOD_C = 1073;
+ public final static int TokenNameFUNC_C = 1074;
}
* IBM Corporation - initial API and implementation
*******************************************************************************/
package net.sourceforge.phpdt.internal.compiler;
-
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Map;
-
import net.sourceforge.phpdt.core.compiler.IProblem;
import net.sourceforge.phpdt.internal.compiler.env.IBinaryType;
import net.sourceforge.phpdt.internal.compiler.env.ICompilationUnit;
import net.sourceforge.phpdt.internal.compiler.util.Util;
import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclaration;
import net.sourceforge.phpeclipse.internal.compiler.ast.TypeDeclaration;
-
public class Compiler implements ITypeRequestor, ProblemSeverities {
- public UnitParser parser;
- public ICompilerRequestor requestor;
-// public CompilerOptions options;
- public ProblemReporter problemReporter;
-
- // management of unit to be processed
- //public CompilationUnitResult currentCompilationUnitResult;
- public CompilationUnitDeclaration[] unitsToProcess;
- public int totalUnits; // (totalUnits-1) gives the last unit in unitToProcess
-
- // name lookup
- public LookupEnvironment lookupEnvironment;
-
- // ONCE STABILIZED, THESE SHOULD RETURN TO A FINAL FIELD
- public static boolean DEBUG = false;
- public int parseThreshold = -1;
- // number of initial units parsed at once (-1: none)
-
- /*
- * Static requestor reserved to listening compilation results in debug mode,
- * so as for example to monitor compiler activity independantly from a particular
- * builder implementation. It is reset at the end of compilation, and should not
- * persist any information after having been reset.
- */
-// public static IDebugRequestor DebugRequestor = null;
-
- /**
- * Answer a new compiler using the given name environment and compiler options.
- * The environment and options will be in effect for the lifetime of the compiler.
- * When the compiler is run, compilation results are sent to the given requestor.
- *
- * @param environment org.eclipse.jdt.internal.compiler.api.env.INameEnvironment
- * Environment used by the compiler in order to resolve type and package
- * names. The name environment implements the actual connection of the compiler
- * to the outside world (e.g. in batch mode the name environment is performing
- * pure file accesses, reuse previous build state or connection to repositories).
- * Note: the name environment is responsible for implementing the actual classpath
- * rules.
- *
- * @param policy org.eclipse.jdt.internal.compiler.api.problem.IErrorHandlingPolicy
- * Configurable part for problem handling, allowing the compiler client to
- * specify the rules for handling problems (stop on first error or accumulate
- * them all) and at the same time perform some actions such as opening a dialog
- * in UI when compiling interactively.
- * @see org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies
- *
- * @param requestor org.eclipse.jdt.internal.compiler.api.ICompilerRequestor
- * Component which will receive and persist all compilation results and is intended
- * to consume them as they are produced. Typically, in a batch compiler, it is
- * responsible for writing out the actual .class files to the file system.
- * @see org.eclipse.jdt.internal.compiler.CompilationResult
- *
- * @param problemFactory org.eclipse.jdt.internal.compiler.api.problem.IProblemFactory
- * Factory used inside the compiler to create problem descriptors. It allows the
- * compiler client to supply its own representation of compilation problems in
- * order to avoid object conversions. Note that the factory is not supposed
- * to accumulate the created problems, the compiler will gather them all and hand
- * them back as part of the compilation unit result.
- */
- public Compiler(
- INameEnvironment environment,
- IErrorHandlingPolicy policy,
-// Map settings,
- final ICompilerRequestor requestor,
- IProblemFactory problemFactory) {
-
- // create a problem handler given a handling policy
-// this.options = new CompilerOptions(settings);
-
- // wrap requestor in DebugRequestor if one is specified
-// if(DebugRequestor == null) {
- this.requestor = requestor;
-// } else {
-// this.requestor = new ICompilerRequestor(){
-// public void acceptResult(CompilationResult result){
-// if (DebugRequestor.isActive()){
-// DebugRequestor.acceptDebugResult(result);
-// }
-// requestor.acceptResult(result);
-// }
-// };
-// }
- this.problemReporter =
- new ProblemReporter(policy, problemFactory);//this.options, problemFactory);
- this.lookupEnvironment =
- new LookupEnvironment(this, problemReporter, environment); //options, problemReporter, environment);
- this.parser =
- new UnitParser(
- problemReporter);
-// this.options.parseLiteralExpressionsAsConstants,
-// options.sourceLevel >= CompilerOptions.JDK1_4);
- }
-
- /**
- * Answer a new compiler using the given name environment and compiler options.
- * The environment and options will be in effect for the lifetime of the compiler.
- * When the compiler is run, compilation results are sent to the given requestor.
- *
- * @param environment org.eclipse.jdt.internal.compiler.api.env.INameEnvironment
- * Environment used by the compiler in order to resolve type and package
- * names. The name environment implements the actual connection of the compiler
- * to the outside world (e.g. in batch mode the name environment is performing
- * pure file accesses, reuse previous build state or connection to repositories).
- * Note: the name environment is responsible for implementing the actual classpath
- * rules.
- *
- * @param policy org.eclipse.jdt.internal.compiler.api.problem.IErrorHandlingPolicy
- * Configurable part for problem handling, allowing the compiler client to
- * specify the rules for handling problems (stop on first error or accumulate
- * them all) and at the same time perform some actions such as opening a dialog
- * in UI when compiling interactively.
- * @see org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies
- *
- * @param requestor org.eclipse.jdt.internal.compiler.api.ICompilerRequestor
- * Component which will receive and persist all compilation results and is intended
- * to consume them as they are produced. Typically, in a batch compiler, it is
- * responsible for writing out the actual .class files to the file system.
- * @see org.eclipse.jdt.internal.compiler.CompilationResult
- *
- * @param problemFactory org.eclipse.jdt.internal.compiler.api.problem.IProblemFactory
- * Factory used inside the compiler to create problem descriptors. It allows the
- * compiler client to supply its own representation of compilation problems in
- * order to avoid object conversions. Note that the factory is not supposed
- * to accumulate the created problems, the compiler will gather them all and hand
- * them back as part of the compilation unit result.
- * @param parseLiteralExpressionsAsConstants <code>boolean</code>
- * This parameter is used to optimize the literals or leave them as they are in the source.
- * If you put true, "Hello" + " world" will be converted to "Hello world".
- */
- public Compiler(
- INameEnvironment environment,
- IErrorHandlingPolicy policy,
-// Map settings,
- final ICompilerRequestor requestor,
- IProblemFactory problemFactory,
- boolean parseLiteralExpressionsAsConstants) {
-
- // create a problem handler given a handling policy
-// this.options = new CompilerOptions(settings);
-
- // wrap requestor in DebugRequestor if one is specified
-// if(DebugRequestor == null) {
- this.requestor = requestor;
-// } else {
-// this.requestor = new ICompilerRequestor(){
-// public void acceptResult(CompilationResult result){
-// if (DebugRequestor.isActive()){
-// DebugRequestor.acceptDebugResult(result);
-// }
-// requestor.acceptResult(result);
-// }
-// };
-// }
- this.problemReporter =
- new ProblemReporter(policy, problemFactory);//, this.options, problemFactory);
- this.lookupEnvironment =
- new LookupEnvironment(this, problemReporter, environment);//options, problemReporter, environment);
- this.parser =
- new UnitParser(
- problemReporter);
-// parseLiteralExpressionsAsConstants,
- // this.options.sourceLevel >= CompilerOptions.JDK1_4);
- }
-
- /**
- * Add an additional binary type
- */
- public void accept(IBinaryType binaryType, PackageBinding packageBinding) {
- lookupEnvironment.createBinaryTypeFrom(binaryType, packageBinding);
- }
-
- /**
- * Add an additional compilation unit into the loop
- * -> build compilation unit declarations, their bindings and record their results.
- */
- public void accept(ICompilationUnit sourceUnit) {
- // Switch the current policy and compilation result for this unit to the requested one.
- CompilationResult unitResult =
- new CompilationResult(sourceUnit, totalUnits, totalUnits, 10); //this.options.maxProblemsPerUnit);
- try {
- // diet parsing for large collection of unit
- CompilationUnitDeclaration parsedUnit;
- if (totalUnits < parseThreshold) {
- parsedUnit = parser.parse(sourceUnit, unitResult,false);
- } else {
- parsedUnit = parser.dietParse(sourceUnit, unitResult);
- }
-
-// if (options.verbose) {
-// String count = String.valueOf(totalUnits + 1);
-// System.out.println(
-// Util.bind(
-// "compilation.request" , //$NON-NLS-1$
-// new String[] {
-// count,
-// count,
-// new String(sourceUnit.getFileName())}));
-// }
-
- // initial type binding creation
- lookupEnvironment.buildTypeBindings(parsedUnit);
- this.addCompilationUnit(sourceUnit, parsedUnit);
-
- // binding resolution
- lookupEnvironment.completeTypeBindings(parsedUnit);
- } catch (AbortCompilationUnit e) {
- // at this point, currentCompilationUnitResult may not be sourceUnit, but some other
- // one requested further along to resolve sourceUnit.
- if (unitResult.compilationUnit == sourceUnit) { // only report once
- requestor.acceptResult(unitResult.tagAsAccepted());
- } else {
- throw e; // want to abort enclosing request to compile
- }
- }
- }
-
- /**
- * Add additional source types
- */
- public void accept(ISourceType[] sourceTypes, PackageBinding packageBinding) {
- problemReporter.abortDueToInternalError(
- Util.bind(
- "abort.againstSourceModel " , //$NON-NLS-1$
- String.valueOf(sourceTypes[0].getName()),
- String.valueOf(sourceTypes[0].getFileName())));
- }
-
- protected void addCompilationUnit(
- ICompilationUnit sourceUnit,
- CompilationUnitDeclaration parsedUnit) {
-
- // append the unit to the list of ones to process later on
- int size = unitsToProcess.length;
- if (totalUnits == size)
- // when growing reposition units starting at position 0
- System.arraycopy(
- unitsToProcess,
- 0,
- (unitsToProcess = new CompilationUnitDeclaration[size * 2]),
- 0,
- totalUnits);
- unitsToProcess[totalUnits++] = parsedUnit;
- }
-
- /**
- * Add the initial set of compilation units into the loop
- * -> build compilation unit declarations, their bindings and record their results.
- */
- protected void beginToCompile(ICompilationUnit[] sourceUnits) {
- int maxUnits = sourceUnits.length;
- totalUnits = 0;
- unitsToProcess = new CompilationUnitDeclaration[maxUnits];
-
- // Switch the current policy and compilation result for this unit to the requested one.
- for (int i = 0; i < maxUnits; i++) {
- CompilationUnitDeclaration parsedUnit;
- CompilationResult unitResult =
- new CompilationResult(sourceUnits[i], i, maxUnits, 10);//, this.options.maxProblemsPerUnit);
- try {
- // diet parsing for large collection of units
- if (totalUnits < parseThreshold) {
- parsedUnit = parser.parse(sourceUnits[i], unitResult, false);
- } else {
- parsedUnit = parser.dietParse(sourceUnits[i], unitResult);
- }
-// if (options.verbose) {
-// System.out.println(
-// Util.bind(
-// "compilation.request" , //$NON-NLS-1$
-// new String[] {
-// String.valueOf(i + 1),
-// String.valueOf(maxUnits),
-// new String(sourceUnits[i].getFileName())}));
-// }
- // initial type binding creation
- lookupEnvironment.buildTypeBindings(parsedUnit);
- this.addCompilationUnit(sourceUnits[i], parsedUnit);
- //} catch (AbortCompilationUnit e) {
- // requestor.acceptResult(unitResult.tagAsAccepted());
- } finally {
- sourceUnits[i] = null; // no longer hold onto the unit
- }
- }
- // binding resolution
- lookupEnvironment.completeTypeBindings();
- }
-
- /**
- * General API
- * -> compile each of supplied files
- * -> recompile any required types for which we have an incomplete principle structure
- */
- public void compile(ICompilationUnit[] sourceUnits) {
- CompilationUnitDeclaration unit = null;
- int i = 0;
- try {
- // build and record parsed units
-
- beginToCompile(sourceUnits);
-
- // process all units (some more could be injected in the loop by the lookup environment)
- for (; i < totalUnits; i++) {
- unit = unitsToProcess[i];
- try {
-// if (options.verbose)
-// System.out.println(
-// Util.bind(
-// "compilation.process" , //$NON-NLS-1$
-// new String[] {
-// String.valueOf(i + 1),
-// String.valueOf(totalUnits),
-// new String(unitsToProcess[i].getFileName())}));
- process(unit, i);
- } finally {
- // cleanup compilation unit result
- unit.cleanUp();
-// if (options.verbose)
-// System.out.println(Util.bind("compilation.done", //$NON-NLS-1$
-// new String[] {
-// String.valueOf(i + 1),
-// String.valueOf(totalUnits),
-// new String(unitsToProcess[i].getFileName())}));
- }
- unitsToProcess[i] = null; // release reference to processed unit declaration
- requestor.acceptResult(unit.compilationResult.tagAsAccepted());
- }
- } catch (AbortCompilation e) {
- this.handleInternalException(e, unit);
- } catch (Error e) {
- this.handleInternalException(e, unit, null);
- throw e; // rethrow
- } catch (RuntimeException e) {
- this.handleInternalException(e, unit, null);
- throw e; // rethrow
- } finally {
- this.reset();
- }
-// if (options.verbose) {
-// if (totalUnits > 1) {
-// System.out.println(
-// Util.bind("compilation.units" , String.valueOf(totalUnits))); //$NON-NLS-1$
-// } else {
-// System.out.println(
-// Util.bind("compilation.unit" , String.valueOf(totalUnits))); //$NON-NLS-1$
-// }
-// }
- }
-
- protected void getMethodBodies(CompilationUnitDeclaration unit, int place) {
- //fill the methods bodies in order for the code to be generated
-
- if (unit.ignoreMethodBodies) {
- unit.ignoreFurtherInvestigation = true;
- return;
- // if initial diet parse did not work, no need to dig into method bodies.
- }
-
- if (place < parseThreshold)
- return; //work already done ...
-
- //real parse of the method....
- parser.scanner.setSource(
- unit.compilationResult.compilationUnit.getContents());
- if (unit.types != null) {
- for (int i = unit.types.size(); --i >= 0;)
- if (unit.types.get(i) instanceof TypeDeclaration) {
- ((TypeDeclaration)unit.types.get(i)).parseMethod(parser, unit);
- }
- }
- }
-
- /*
- * Compiler crash recovery in case of unexpected runtime exceptions
- */
- protected void handleInternalException(
- Throwable internalException,
- CompilationUnitDeclaration unit,
- CompilationResult result) {
-
- /* dump a stack trace to the console */
- internalException.printStackTrace();
-
- /* find a compilation result */
- if ((unit != null)) // basing result upon the current unit if available
- result = unit.compilationResult; // current unit being processed ?
- if ((result == null) && (unitsToProcess != null) && (totalUnits > 0))
- result = unitsToProcess[totalUnits - 1].compilationResult;
- // last unit in beginToCompile ?
-
- if (result != null) {
- /* create and record a compilation problem */
- StringWriter stringWriter = new StringWriter();
- PrintWriter writer = new PrintWriter(stringWriter);
- internalException.printStackTrace(writer);
- StringBuffer buffer = stringWriter.getBuffer();
-
- String[] pbArguments = new String[] {
- Util.bind("compilation.internalError" ) //$NON-NLS-1$
- + "\n" //$NON-NLS-1$
- + buffer.toString()};
-
- result
- .record(
- problemReporter
- .createProblem(
- result.getFileName(),
- IProblem.Unclassified,
- pbArguments,
- pbArguments,
- Error, // severity
- 0, // source start
- 0, // source end
- 0, // line number
- unit,
- result),
- unit);
-
- /* hand back the compilation result */
- if (!result.hasBeenAccepted) {
- requestor.acceptResult(result.tagAsAccepted());
- }
- }
- }
-
- /*
- * Compiler recovery in case of internal AbortCompilation event
- */
- protected void handleInternalException(
- AbortCompilation abortException,
- CompilationUnitDeclaration unit) {
-
- /* special treatment for SilentAbort: silently cancelling the compilation process */
- if (abortException.isSilent) {
- if (abortException.silentException == null) {
- return;
- } else {
- throw abortException.silentException;
- }
- }
-
- /* uncomment following line to see where the abort came from */
- // abortException.printStackTrace();
-
- // Exception may tell which compilation result it is related, and which problem caused it
- CompilationResult result = abortException.compilationResult;
- if ((result == null) && (unit != null))
- result = unit.compilationResult; // current unit being processed ?
- if ((result == null) && (unitsToProcess != null) && (totalUnits > 0))
- result = unitsToProcess[totalUnits - 1].compilationResult;
- // last unit in beginToCompile ?
- if (result != null && !result.hasBeenAccepted) {
- /* distant problem which could not be reported back there */
- if (abortException.problemId != 0) {
- result
- .record(
- problemReporter
- .createProblem(
- result.getFileName(),
- abortException.problemId,
- abortException.problemArguments,
- abortException.messageArguments,
- Error, // severity
- 0, // source start
- 0, // source end
- 0, // line number
- unit,
- result),
- unit);
- } else {
- /* distant internal exception which could not be reported back there */
- if (abortException.exception != null) {
- this.handleInternalException(abortException.exception, null, result);
- return;
- }
- }
- /* hand back the compilation result */
- if (!result.hasBeenAccepted) {
- requestor.acceptResult(result.tagAsAccepted());
- }
- } else {
- /*
- if (abortException.problemId != 0){
- IProblem problem =
- problemReporter.createProblem(
- "???".toCharArray(),
- abortException.problemId,
- abortException.problemArguments,
- Error, // severity
- 0, // source start
- 0, // source end
- 0); // line number
- System.out.println(problem.getMessage());
- }
- */
- abortException.printStackTrace();
- }
- }
-
- /**
- * Process a compilation unit already parsed and build.
- */
- public void process(CompilationUnitDeclaration unit, int i) {
-
- getMethodBodies(unit, i);
-
- // fault in fields & methods
- if (unit.scope != null)
- unit.scope.faultInTypes();
-
- // verify inherited methods
- if (unit.scope != null)
- unit.scope.verifyMethods(lookupEnvironment.methodVerifier());
-
- // type checking
- unit.resolve();
-
- // flow analysis
- unit.analyseCode();
-
- // code generation
-// unit.generateCode();
-
- // reference info
-// if (options.produceReferenceInfo && unit.scope != null)
-// unit.scope.storeDependencyInfo();
-
- // refresh the total number of units known at this stage
- unit.compilationResult.totalUnitsKnown = totalUnits;
- }
- public void reset() {
- lookupEnvironment.reset();
- parser.scanner.source = null;
- unitsToProcess = null;
-// if (DebugRequestor != null) DebugRequestor.reset();
- }
-
- /**
- * Internal API used to resolve a given compilation unit. Can run a subset of the compilation process
- */
- public CompilationUnitDeclaration resolve(
- ICompilationUnit sourceUnit,
- boolean verifyMethods,
- boolean analyzeCode) {
-// boolean generateCode) {
-
- CompilationUnitDeclaration unit = null;
- try {
- // build and record parsed units
- parseThreshold = 0; // will request a full parse
- beginToCompile(new ICompilationUnit[] { sourceUnit });
- // process all units (some more could be injected in the loop by the lookup environment)
- unit = unitsToProcess[0];
- getMethodBodies(unit, 0);
- if (unit.scope != null) {
-// // fault in fields & methods
-// unit.scope.faultInTypes();
-
-// if (unit.scope != null && verifyMethods) {
-// // http://dev.eclipse.org/bugs/show_bug.cgi?id=23117
-// // verify inherited methods
-// unit.scope.verifyMethods(lookupEnvironment.methodVerifier());
-// }
-// // type checking
-// unit.resolve();
-
- // flow analysis
-// if (analyzeCode) unit.analyseCode();
-
- // code generation
-// if (generateCode) unit.generateCode();
- }
- unitsToProcess[0] = null; // release reference to processed unit declaration
- requestor.acceptResult(unit.compilationResult.tagAsAccepted());
- return unit;
- } catch (AbortCompilation e) {
- this.handleInternalException(e, unit);
- return unit == null ? unitsToProcess[0] : unit;
- } catch (Error e) {
- this.handleInternalException(e, unit, null);
- throw e; // rethrow
- } catch (RuntimeException e) {
- this.handleInternalException(e, unit, null);
- throw e; // rethrow
- } finally {
- // No reset is performed there anymore since,
- // within the CodeAssist (or related tools),
- // the compiler may be called *after* a call
- // to this resolve(...) method. And such a call
- // needs to have a compiler with a non-empty
- // environment.
- // this.reset();
- }
- }
+ public UnitParser parser;
+ public ICompilerRequestor requestor;
+ // public CompilerOptions options;
+ public ProblemReporter problemReporter;
+ // management of unit to be processed
+ //public CompilationUnitResult currentCompilationUnitResult;
+ public CompilationUnitDeclaration[] unitsToProcess;
+ public int totalUnits; // (totalUnits-1) gives the last unit in unitToProcess
+ // name lookup
+ public LookupEnvironment lookupEnvironment;
+ // ONCE STABILIZED, THESE SHOULD RETURN TO A FINAL FIELD
+ public static boolean DEBUG = false;
+ public int parseThreshold = -1;
+ // number of initial units parsed at once (-1: none)
+ /*
+ * Static requestor reserved to listening compilation results in debug mode,
+ * so as for example to monitor compiler activity independantly from a
+ * particular builder implementation. It is reset at the end of compilation,
+ * and should not persist any information after having been reset.
+ */
+ // public static IDebugRequestor DebugRequestor = null;
+ /**
+ * Answer a new compiler using the given name environment and compiler
+ * options. The environment and options will be in effect for the lifetime of
+ * the compiler. When the compiler is run, compilation results are sent to
+ * the given requestor.
+ *
+ * @param environment
+ * org.eclipse.jdt.internal.compiler.api.env.INameEnvironment
+ * Environment used by the compiler in order to resolve type and
+ * package names. The name environment implements the actual
+ * connection of the compiler to the outside world (e.g. in batch
+ * mode the name environment is performing pure file accesses,
+ * reuse previous build state or connection to repositories).
+ * Note: the name environment is responsible for implementing the
+ * actual classpath rules.
+ *
+ * @param policy
+ * org.eclipse.jdt.internal.compiler.api.problem.IErrorHandlingPolicy
+ * Configurable part for problem handling, allowing the compiler
+ * client to specify the rules for handling problems (stop on
+ * first error or accumulate them all) and at the same time
+ * perform some actions such as opening a dialog in UI when
+ * compiling interactively.
+ * @see org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies
+ *
+ * @param requestor
+ * org.eclipse.jdt.internal.compiler.api.ICompilerRequestor
+ * Component which will receive and persist all compilation
+ * results and is intended to consume them as they are produced.
+ * Typically, in a batch compiler, it is responsible for writing
+ * out the actual .class files to the file system.
+ * @see org.eclipse.jdt.internal.compiler.CompilationResult
+ *
+ * @param problemFactory
+ * org.eclipse.jdt.internal.compiler.api.problem.IProblemFactory
+ * Factory used inside the compiler to create problem descriptors.
+ * It allows the compiler client to supply its own representation
+ * of compilation problems in order to avoid object conversions.
+ * Note that the factory is not supposed to accumulate the created
+ * problems, the compiler will gather them all and hand them back
+ * as part of the compilation unit result.
+ */
+ public Compiler(INameEnvironment environment, IErrorHandlingPolicy policy,
+ // Map settings,
+ final ICompilerRequestor requestor, IProblemFactory problemFactory) {
+ // create a problem handler given a handling policy
+ // this.options = new CompilerOptions(settings);
+ // wrap requestor in DebugRequestor if one is specified
+ // if(DebugRequestor == null) {
+ this.requestor = requestor;
+ // } else {
+ // this.requestor = new ICompilerRequestor(){
+ // public void acceptResult(CompilationResult result){
+ // if (DebugRequestor.isActive()){
+ // DebugRequestor.acceptDebugResult(result);
+ // }
+ // requestor.acceptResult(result);
+ // }
+ // };
+ // }
+ this.problemReporter = new ProblemReporter(policy, problemFactory);//this.options,
+ // problemFactory);
+ this.lookupEnvironment = new LookupEnvironment(this, problemReporter,
+ environment); //options, problemReporter, environment);
+ this.parser = new UnitParser(problemReporter);
+ // this.options.parseLiteralExpressionsAsConstants,
+ // options.sourceLevel >= CompilerOptions.JDK1_4);
+ }
+ /**
+ * Answer a new compiler using the given name environment and compiler
+ * options. The environment and options will be in effect for the lifetime of
+ * the compiler. When the compiler is run, compilation results are sent to
+ * the given requestor.
+ *
+ * @param environment
+ * org.eclipse.jdt.internal.compiler.api.env.INameEnvironment
+ * Environment used by the compiler in order to resolve type and
+ * package names. The name environment implements the actual
+ * connection of the compiler to the outside world (e.g. in batch
+ * mode the name environment is performing pure file accesses,
+ * reuse previous build state or connection to repositories).
+ * Note: the name environment is responsible for implementing the
+ * actual classpath rules.
+ *
+ * @param policy
+ * org.eclipse.jdt.internal.compiler.api.problem.IErrorHandlingPolicy
+ * Configurable part for problem handling, allowing the compiler
+ * client to specify the rules for handling problems (stop on
+ * first error or accumulate them all) and at the same time
+ * perform some actions such as opening a dialog in UI when
+ * compiling interactively.
+ * @see org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies
+ *
+ * @param requestor
+ * org.eclipse.jdt.internal.compiler.api.ICompilerRequestor
+ * Component which will receive and persist all compilation
+ * results and is intended to consume them as they are produced.
+ * Typically, in a batch compiler, it is responsible for writing
+ * out the actual .class files to the file system.
+ * @see org.eclipse.jdt.internal.compiler.CompilationResult
+ *
+ * @param problemFactory
+ * org.eclipse.jdt.internal.compiler.api.problem.IProblemFactory
+ * Factory used inside the compiler to create problem descriptors.
+ * It allows the compiler client to supply its own representation
+ * of compilation problems in order to avoid object conversions.
+ * Note that the factory is not supposed to accumulate the created
+ * problems, the compiler will gather them all and hand them back
+ * as part of the compilation unit result.
+ * @param parseLiteralExpressionsAsConstants
+ * <code>boolean</code> This parameter is used to optimize the
+ * literals or leave them as they are in the source. If you put
+ * true, "Hello" + " world" will be converted to "Hello world".
+ */
+ public Compiler(INameEnvironment environment, IErrorHandlingPolicy policy,
+ // Map settings,
+ final ICompilerRequestor requestor, IProblemFactory problemFactory,
+ boolean parseLiteralExpressionsAsConstants) {
+ // create a problem handler given a handling policy
+ // this.options = new CompilerOptions(settings);
+ // wrap requestor in DebugRequestor if one is specified
+ // if(DebugRequestor == null) {
+ this.requestor = requestor;
+ // } else {
+ // this.requestor = new ICompilerRequestor(){
+ // public void acceptResult(CompilationResult result){
+ // if (DebugRequestor.isActive()){
+ // DebugRequestor.acceptDebugResult(result);
+ // }
+ // requestor.acceptResult(result);
+ // }
+ // };
+ // }
+ this.problemReporter = new ProblemReporter(policy, problemFactory);//,
+ // this.options,
+ // problemFactory);
+ this.lookupEnvironment = new LookupEnvironment(this, problemReporter,
+ environment);//options, problemReporter, environment);
+ this.parser = new UnitParser(problemReporter);
+ // parseLiteralExpressionsAsConstants,
+ // this.options.sourceLevel >= CompilerOptions.JDK1_4);
+ }
+ /**
+ * Add an additional binary type
+ */
+ public void accept(IBinaryType binaryType, PackageBinding packageBinding) {
+ lookupEnvironment.createBinaryTypeFrom(binaryType, packageBinding);
+ }
+ /**
+ * Add an additional compilation unit into the loop -> build compilation unit
+ * declarations, their bindings and record their results.
+ */
+ public void accept(ICompilationUnit sourceUnit) {
+ // Switch the current policy and compilation result for this unit to the
+ // requested one.
+ CompilationResult unitResult = new CompilationResult(sourceUnit,
+ totalUnits, totalUnits, 10); //this.options.maxProblemsPerUnit);
+ try {
+ // diet parsing for large collection of unit
+ CompilationUnitDeclaration parsedUnit;
+ if (totalUnits < parseThreshold) {
+ parsedUnit = parser.parse(sourceUnit, unitResult, false);
+ } else {
+ parsedUnit = parser.dietParse(sourceUnit, unitResult);
+ }
+ // if (options.verbose) {
+ // String count = String.valueOf(totalUnits + 1);
+ // System.out.println(
+ // Util.bind(
+ // "compilation.request" , //$NON-NLS-1$
+ // new String[] {
+ // count,
+ // count,
+ // new String(sourceUnit.getFileName())}));
+ // }
+ // initial type binding creation
+ lookupEnvironment.buildTypeBindings(parsedUnit);
+ this.addCompilationUnit(sourceUnit, parsedUnit);
+ // binding resolution
+ lookupEnvironment.completeTypeBindings(parsedUnit);
+ } catch (AbortCompilationUnit e) {
+ // at this point, currentCompilationUnitResult may not be sourceUnit, but
+ // some other
+ // one requested further along to resolve sourceUnit.
+ if (unitResult.compilationUnit == sourceUnit) { // only report once
+ requestor.acceptResult(unitResult.tagAsAccepted());
+ } else {
+ throw e; // want to abort enclosing request to compile
+ }
+ }
+ }
+ /**
+ * Add additional source types
+ */
+ public void accept(ISourceType[] sourceTypes, PackageBinding packageBinding) {
+ problemReporter.abortDueToInternalError(Util.bind(
+ "abort.againstSourceModel ", //$NON-NLS-1$
+ String.valueOf(sourceTypes[0].getName()), String.valueOf(sourceTypes[0]
+ .getFileName())));
+ }
+ protected void addCompilationUnit(ICompilationUnit sourceUnit,
+ CompilationUnitDeclaration parsedUnit) {
+ // append the unit to the list of ones to process later on
+ int size = unitsToProcess.length;
+ if (totalUnits == size)
+ // when growing reposition units starting at position 0
+ System.arraycopy(unitsToProcess, 0,
+ (unitsToProcess = new CompilationUnitDeclaration[size * 2]), 0,
+ totalUnits);
+ unitsToProcess[totalUnits++] = parsedUnit;
+ }
+ /**
+ * Add the initial set of compilation units into the loop -> build
+ * compilation unit declarations, their bindings and record their results.
+ */
+ protected void beginToCompile(ICompilationUnit[] sourceUnits) {
+ int maxUnits = sourceUnits.length;
+ totalUnits = 0;
+ unitsToProcess = new CompilationUnitDeclaration[maxUnits];
+ // Switch the current policy and compilation result for this unit to the
+ // requested one.
+ for (int i = 0; i < maxUnits; i++) {
+ CompilationUnitDeclaration parsedUnit;
+ CompilationResult unitResult = new CompilationResult(sourceUnits[i], i,
+ maxUnits, 10);//, this.options.maxProblemsPerUnit);
+ try {
+ // diet parsing for large collection of units
+ if (totalUnits < parseThreshold) {
+ parsedUnit = parser.parse(sourceUnits[i], unitResult, false);
+ } else {
+ parsedUnit = parser.dietParse(sourceUnits[i], unitResult);
+ }
+ // if (options.verbose) {
+ // System.out.println(
+ // Util.bind(
+ // "compilation.request" , //$NON-NLS-1$
+ // new String[] {
+ // String.valueOf(i + 1),
+ // String.valueOf(maxUnits),
+ // new String(sourceUnits[i].getFileName())}));
+ // }
+ // initial type binding creation
+ lookupEnvironment.buildTypeBindings(parsedUnit);
+ this.addCompilationUnit(sourceUnits[i], parsedUnit);
+ //} catch (AbortCompilationUnit e) {
+ //requestor.acceptResult(unitResult.tagAsAccepted());
+ } finally {
+ sourceUnits[i] = null; // no longer hold onto the unit
+ }
+ }
+ // binding resolution
+ lookupEnvironment.completeTypeBindings();
+ }
+ /**
+ * General API -> compile each of supplied files -> recompile any required
+ * types for which we have an incomplete principle structure
+ */
+ public void compile(ICompilationUnit[] sourceUnits) {
+ CompilationUnitDeclaration unit = null;
+ int i = 0;
+ try {
+ // build and record parsed units
+ beginToCompile(sourceUnits);
+ // process all units (some more could be injected in the loop by the
+ // lookup environment)
+ for (; i < totalUnits; i++) {
+ unit = unitsToProcess[i];
+ try {
+ // if (options.verbose)
+ // System.out.println(
+ // Util.bind(
+ // "compilation.process" , //$NON-NLS-1$
+ // new String[] {
+ // String.valueOf(i + 1),
+ // String.valueOf(totalUnits),
+ // new String(unitsToProcess[i].getFileName())}));
+ process(unit, i);
+ } finally {
+ // cleanup compilation unit result
+ unit.cleanUp();
+ // if (options.verbose)
+ // System.out.println(Util.bind("compilation.done", //$NON-NLS-1$
+ // new String[] {
+ // String.valueOf(i + 1),
+ // String.valueOf(totalUnits),
+ // new String(unitsToProcess[i].getFileName())}));
+ }
+ unitsToProcess[i] = null; // release reference to processed unit
+ // declaration
+ requestor.acceptResult(unit.compilationResult.tagAsAccepted());
+ }
+ } catch (AbortCompilation e) {
+ this.handleInternalException(e, unit);
+ } catch (Error e) {
+ this.handleInternalException(e, unit, null);
+ throw e; // rethrow
+ } catch (RuntimeException e) {
+ this.handleInternalException(e, unit, null);
+ throw e; // rethrow
+ } finally {
+ this.reset();
+ }
+ // if (options.verbose) {
+ // if (totalUnits > 1) {
+ // System.out.println(
+ // Util.bind("compilation.units" , String.valueOf(totalUnits)));
+ // //$NON-NLS-1$
+ // } else {
+ // System.out.println(
+ // Util.bind("compilation.unit" , String.valueOf(totalUnits)));
+ // //$NON-NLS-1$
+ // }
+ // }
+ }
+ protected void getMethodBodies(CompilationUnitDeclaration unit, int place) {
+ //fill the methods bodies in order for the code to be generated
+ if (unit.ignoreMethodBodies) {
+ unit.ignoreFurtherInvestigation = true;
+ return;
+ // if initial diet parse did not work, no need to dig into method bodies.
+ }
+ if (place < parseThreshold)
+ return; //work already done ...
+ //real parse of the method....
+ parser.scanner.setSource(unit.compilationResult.compilationUnit
+ .getContents());
+ if (unit.types != null) {
+ for (int i = unit.types.size(); --i >= 0;)
+ if (unit.types.get(i) instanceof TypeDeclaration) {
+ ((TypeDeclaration) unit.types.get(i)).parseMethod(parser, unit);
+ }
+ }
+ }
+ /*
+ * Compiler crash recovery in case of unexpected runtime exceptions
+ */
+ protected void handleInternalException(Throwable internalException,
+ CompilationUnitDeclaration unit, CompilationResult result) {
+ /* dump a stack trace to the console */
+ internalException.printStackTrace();
+ /* find a compilation result */
+ if ((unit != null)) // basing result upon the current unit if available
+ result = unit.compilationResult; // current unit being processed ?
+ if ((result == null) && (unitsToProcess != null) && (totalUnits > 0))
+ result = unitsToProcess[totalUnits - 1].compilationResult;
+ // last unit in beginToCompile ?
+ if (result != null) {
+ /* create and record a compilation problem */
+ StringWriter stringWriter = new StringWriter();
+ PrintWriter writer = new PrintWriter(stringWriter);
+ internalException.printStackTrace(writer);
+ StringBuffer buffer = stringWriter.getBuffer();
+ String[] pbArguments = new String[]{Util
+ .bind("compilation.internalError")
+ //$NON-NLS-1$
+ + "\n" //$NON-NLS-1$
+ + buffer.toString()};
+ result.record(problemReporter.createProblem(result.getFileName(),
+ IProblem.Unclassified, pbArguments, pbArguments, Error, // severity
+ 0, // source start
+ 0, // source end
+ 0, // line number
+ unit, result), unit);
+ /* hand back the compilation result */
+ if (!result.hasBeenAccepted) {
+ requestor.acceptResult(result.tagAsAccepted());
+ }
+ }
+ }
+ /*
+ * Compiler recovery in case of internal AbortCompilation event
+ */
+ protected void handleInternalException(AbortCompilation abortException,
+ CompilationUnitDeclaration unit) {
+ /*
+ * special treatment for SilentAbort: silently cancelling the compilation
+ * process
+ */
+ if (abortException.isSilent) {
+ if (abortException.silentException == null) {
+ return;
+ } else {
+ throw abortException.silentException;
+ }
+ }
+ /* uncomment following line to see where the abort came from */
+ // abortException.printStackTrace();
+ // Exception may tell which compilation result it is related, and which
+ // problem caused it
+ CompilationResult result = abortException.compilationResult;
+ if ((result == null) && (unit != null))
+ result = unit.compilationResult; // current unit being processed ?
+ if ((result == null) && (unitsToProcess != null) && (totalUnits > 0))
+ result = unitsToProcess[totalUnits - 1].compilationResult;
+ // last unit in beginToCompile ?
+ if (result != null && !result.hasBeenAccepted) {
+ /* distant problem which could not be reported back there */
+ if (abortException.problemId != 0) {
+ result.record(problemReporter.createProblem(result.getFileName(),
+ abortException.problemId, abortException.problemArguments,
+ abortException.messageArguments, Error, // severity
+ 0, // source start
+ 0, // source end
+ 0, // line number
+ unit, result), unit);
+ } else {
+ /* distant internal exception which could not be reported back there */
+ if (abortException.exception != null) {
+ this.handleInternalException(abortException.exception, null, result);
+ return;
+ }
+ }
+ /* hand back the compilation result */
+ if (!result.hasBeenAccepted) {
+ requestor.acceptResult(result.tagAsAccepted());
+ }
+ } else {
+ /*
+ * if (abortException.problemId != 0){ IProblem problem =
+ * problemReporter.createProblem( "???".toCharArray(),
+ * abortException.problemId, abortException.problemArguments, Error, //
+ * severity 0, // source start 0, // source end 0); // line number
+ * System.out.println(problem.getMessage()); }
+ */
+ abortException.printStackTrace();
+ }
+ }
+ /**
+ * Process a compilation unit already parsed and build.
+ */
+ public void process(CompilationUnitDeclaration unit, int i) {
+ getMethodBodies(unit, i);
+ // fault in fields & methods
+ if (unit.scope != null)
+ unit.scope.faultInTypes();
+ // verify inherited methods
+ if (unit.scope != null)
+ unit.scope.verifyMethods(lookupEnvironment.methodVerifier());
+ // type checking
+ unit.resolve();
+ // flow analysis
+ unit.analyseCode();
+ // code generation
+ // unit.generateCode();
+ // reference info
+ // if (options.produceReferenceInfo && unit.scope != null)
+ // unit.scope.storeDependencyInfo();
+ // refresh the total number of units known at this stage
+ unit.compilationResult.totalUnitsKnown = totalUnits;
+ }
+ public void reset() {
+ lookupEnvironment.reset();
+ parser.scanner.source = null;
+ unitsToProcess = null;
+ // if (DebugRequestor != null) DebugRequestor.reset();
+ }
+ /**
+ * Internal API used to resolve a given compilation unit. Can run a subset of
+ * the compilation process
+ */
+ public CompilationUnitDeclaration resolve(ICompilationUnit sourceUnit,
+ boolean verifyMethods, boolean analyzeCode) {
+ // boolean generateCode) {
+ CompilationUnitDeclaration unit = null;
+ try {
+ // build and record parsed units
+ parseThreshold = 0; // will request a full parse
+ beginToCompile(new ICompilationUnit[]{sourceUnit});
+ // process all units (some more could be injected in the loop by the
+ // lookup environment)
+ unit = unitsToProcess[0];
+ getMethodBodies(unit, 0);
+ if (unit.scope != null) {
+ // // fault in fields & methods
+ // unit.scope.faultInTypes();
+ // if (unit.scope != null && verifyMethods) {
+ // // http://dev.eclipse.org/bugs/show_bug.cgi?id=23117
+ // // verify inherited methods
+ // unit.scope.verifyMethods(lookupEnvironment.methodVerifier());
+ // }
+ // // type checking
+ // unit.resolve();
+ // flow analysis
+ // if (analyzeCode) unit.analyseCode();
+ // code generation
+ // if (generateCode) unit.generateCode();
+ }
+ unitsToProcess[0] = null; // release reference to processed unit
+ // declaration
+ requestor.acceptResult(unit.compilationResult.tagAsAccepted());
+ return unit;
+ } catch (AbortCompilation e) {
+ this.handleInternalException(e, unit);
+ return unit == null ? unitsToProcess[0] : unit;
+ } catch (Error e) {
+ this.handleInternalException(e, unit, null);
+ throw e; // rethrow
+ } catch (RuntimeException e) {
+ this.handleInternalException(e, unit, null);
+ throw e; // rethrow
+ } finally {
+ // No reset is performed there anymore since,
+ // within the CodeAssist (or related tools),
+ // the compiler may be called *after* a call
+ // to this resolve(...) method. And such a call
+ // needs to have a compiler with a non-empty
+ // environment.
+ // this.reset();
+ }
+ }
}
private void throwSyntaxError(String error) {
int problemStartPosition = scanner.getCurrentTokenStartPosition();
int problemEndPosition = scanner.getCurrentTokenEndPosition();
- throwSyntaxError(error, problemStartPosition, problemEndPosition);
+ throwSyntaxError(error, problemStartPosition, problemEndPosition+1);
}
/**
* This method will throw the SyntaxError. It will add the good lines and
}
return;
}
- /**
- * Get a number. if it's a <code>double</code> the number will be stored in
- * <code>doubleNumber</code> and the token will have the value
- * {@link Parser#TokenNameDOUBLE_NUMBER}<br />
- * if it's a <code>double</code> the number will be stored in <code>longNumber</code>
- * and the token will have the value {@link Parser#TokenNameINT_NUMBER}
- */
- // private void getNumber() {
- // StringBuffer inum = new StringBuffer();
- // char dFlag = ' ';
- // int numFormat = 10;
- //
- // // save first digit
- // char firstCh = ch;
- // inum.append(ch);
- //
- // getChar();
- // // determine number conversions:
- // if (firstCh == '0') {
- // switch (ch) {
- // case 'b' :
- // numFormat = 2;
- // getChar();
- // break;
- // case 'B' :
- // numFormat = 2;
- // getChar();
- // break;
- // case 'o' :
- // numFormat = 8;
- // getChar();
- // break;
- // case 'O' :
- // numFormat = 8;
- // getChar();
- // break;
- // case 'x' :
- // numFormat = 16;
- // getChar();
- // break;
- // case 'X' :
- // numFormat = 16;
- // getChar();
- // break;
- // }
- // }
- //
- // if (numFormat == 16) {
- // while ((ch >= '0' && ch <= '9')
- // || (ch >= 'a' && ch <= 'f')
- // || (ch >= 'A' && ch <= 'F')) {
- // inum.append(ch);
- // getChar();
- // }
- // } else {
- // while ((ch >= '0' && ch <= '9')
- // || (ch == '.')
- // || (ch == 'E')
- // || (ch == 'e')) {
- // if ((ch == '.') || (ch == 'E') || (ch == 'e')) {
- // if (ch == '.' && dFlag != ' ') {
- // break;
- // }
- // if ((dFlag == 'E') || (dFlag == 'e')) {
- // break;
- // }
- // dFlag = ch;
- // inum.append(ch);
- // getChar();
- // if ((ch == '-') || (ch == '+')) {
- // inum.append(ch);
- // getChar();
- // }
- // } else {
- // inum.append(ch);
- // getChar();
- // }
- // }
- // }
- // chIndx--;
- //
- // try {
- // if (dFlag != ' ') {
- // doubleNumber = new Double(inum.toString());
- // token = TokenNameDoubleLiteral;
- // return;
- // } else {
- // longNumber = Long.valueOf(inum.toString(), numFormat);
- // token = TokenNameIntegerLiteral;
- // return;
- // }
- //
- // } catch (Throwable e) {
- // throwSyntaxError("Number format error: " + inum.toString());
- // }
- // }
- //
- // /**
- // * Get a String.
- // * @param openChar the opening char ('\'', '"', '`')
- // * @param typeString the type of string {@link
- // #TokenNameSTRING_CONSTANT},{@link #TokenNameINTERPOLATED_STRING}
- // * @param errorMsg the error message in case of parse error in the string
- // */
- // private void getString(
- // final char openChar,
- // final int typeString,
- // final String errorMsg) {
- // StringBuffer sBuffer = new StringBuffer();
- // boolean openString = true;
- // int startRow = rowCount;
- // while (str.length() > chIndx) {
- // ch = str.charAt(chIndx++);
- // if (ch == '\\') {
- // sBuffer.append(ch);
- // if (str.length() > chIndx) {
- // ch = str.charAt(chIndx++);
- // sBuffer.append(ch);
- // }
- // } else if (ch == openChar) {
- // openString = false;
- // break;
- // } else if (ch == '\n') {
- // rowCount++;
- // columnCount = chIndx;
- // } else {
- // sBuffer.append(ch);
- // }
- // }
- // if (openString) {
- // if (typeString == TokenNameStringConstant) {
- // throwSyntaxError(errorMsg, startRow);
- // } else {
- // throwSyntaxError(errorMsg);
- // }
- // }
- // token = typeString;
- // stringValue = sBuffer.toString();
- // }
- // public void htmlParserTester(String input) {
- // int lineNumber = 1;
- // int startLineNumber = 1;
- // int startIndex = 0;
- // char ch;
- // char ch2;
- // boolean phpMode = false;
- // boolean phpFound = false;
- //
- // phpList = new ArrayList();
- // currentPHPString = 0;
- //
- // try {
- // int i = 0;
- // while (i < input.length()) {
- // ch = input.charAt(i++);
- // if (ch == '\n') {
- // lineNumber++;
- // }
- // if ((!phpMode) && ch == '<') {
- // ch2 = input.charAt(i++);
- // if (ch2 == '?') {
- // ch2 = input.charAt(i++);
- // if (Character.isWhitespace(ch2)) {
- // // php start
- // phpMode = true;
- // phpFound = true;
- // startIndex = i;
- // startLineNumber = lineNumber;
- // continue;
- // } else if (ch2 == 'p') {
- // ch2 = input.charAt(i++);
- // if (ch2 == 'h') {
- // ch2 = input.charAt(i++);
- // if (ch2 == 'p') {
- // phpMode = true;
- // phpFound = true;
- // startIndex = i;
- // startLineNumber = lineNumber;
- // continue;
- // }
- // i--;
- // }
- // i--;
- // } else if (ch2 == 'P') {
- // ch2 = input.charAt(i++);
- // if (ch2 == 'H') {
- // ch2 = input.charAt(i++);
- // if (ch2 == 'P') {
- // phpMode = true;
- // phpFound = true;
- // startIndex = i;
- // startLineNumber = lineNumber;
- // continue;
- // }
- // i--;
- // }
- // i--;
- // }
- // i--;
- // }
- // i--;
- // }
- //
- // if (phpMode) {
- // if (ch == '/' && i < input.length()) {
- // ch2 = input.charAt(i++);
- // if (ch2 == '/') {
- // while (i < input.length()) {
- // ch = input.charAt(i++);
- // if (ch == '?' && i < input.length()) {
- // ch2 = input.charAt(i++);
- // if (ch2 == '>') {
- // // php end
- // phpMode = false;
- // phpList.add(
- // new PHPString(
- // input.substring(
- // startIndex,
- // i - 2),
- // startLineNumber));
- // continue;
- // }
- // i--;
- // } else if (ch == '\n') {
- // lineNumber++;
- // break;
- // }
- // }
- // continue;
- // } else if (ch2 == '*') {
- // // multi-line comment
- // while (i < input.length()) {
- // ch = input.charAt(i++);
- // if (ch == '\n') {
- // lineNumber++;
- // } else if (ch == '*' && i < input.length()) {
- // ch2 = input.charAt(i++);
- // if (ch2 == '/') {
- // break;
- // }
- // i--;
- // }
- // }
- // continue;
- // } else {
- // i--;
- // }
- // } else if (ch == '#') {
- // while (i < input.length()) {
- // ch = input.charAt(i++);
- // if (ch == '?' && i < input.length()) {
- // ch2 = input.charAt(i++);
- // if (ch2 == '>') {
- // // php end
- // phpMode = false;
- // phpList.add(
- // new PHPString(
- // input.substring(startIndex, i - 2),
- // startLineNumber));
- // continue;
- // }
- // i--;
- // } else if (ch == '\n') {
- // lineNumber++;
- // break;
- // }
- // }
- // continue;
- // } else if (ch == '"') {
- // ch = ' ';
- // while (i < input.length()) {
- // ch = input.charAt(i++);
- // if (ch == '\n') {
- // lineNumber++;
- // } else if (
- // ch == '\\' && i < input.length()) { // escape
- // i++;
- // } else if (ch == '"') {
- // break;
- // }
- // }
- // continue;
- // } else if (ch == '\'') {
- // ch = ' ';
- // while (i < input.length()) {
- // ch = input.charAt(i++);
- // if (ch == '\n') {
- // lineNumber++;
- // } else if (
- // ch == '\\' && i < input.length()) { // escape
- // i++;
- // } else if (ch == '\'') {
- // break;
- // }
- // }
- // continue;
- // }
- //
- // if (ch == '?' && i < input.length()) {
- // ch2 = input.charAt(i++);
- // if (ch2 == '>') {
- // // php end
- // phpMode = false;
- // phpList.add(
- // new PHPString(
- // input.substring(startIndex, i - 2),
- // startLineNumber));
- // continue;
- // }
- // i--;
- // }
- // }
- // }
- //
- // if (!phpFound) {
- // setMarker(
- // "No PHP source code found.",
- // lineNumber,
- // PHPParser.INFO);
- // } else {
- // if (phpMode) {
- // setMarker(
- // "Open PHP tag at end of file.",
- // lineNumber,
- // PHPParser.INFO);
- // phpList.add(
- // new PHPString(
- // input.substring(startIndex, i - 2),
- // startLineNumber));
- // }
- // // for (int j=0;j<phpList.size();j++) {
- // // String temp = ((PHPString)phpList.get(j)).getPHPString();
- // // int startIndx = temp.length()-10;
- // // if (startIndx<0) {
- // // startIndx = 0;
- // // }
- // // System.out.println(temp.substring(startIndx)+"?>");
- // // }
- // phpParserTester(null, 1);
- // // PHPString temp;
- // // for(int j=0;j<phpList.size();j++) {
- // // temp = (PHPString) phpList.get(j);
- // // parser.start(temp.getPHPString(), temp.getLineNumber());
- // // }
- // }
- // } catch (CoreException e) {
- // }
- // }
- // public void phpParserTester(String s, int rowCount) {
- // this.str = s;
- // if (s == null) {
- // if (phpList.size() != 0) {
- // this.str = ((PHPString) phpList.get(currentPHPString++)).getPHPString();
- // }
- // }
- // this.token = TokenNameEOF;
- // // this.chIndx = 0;
- // // this.rowCount = rowCount;
- // // this.columnCount = 0;
- // this.phpEnd = false;
- // this.phpMode = true;
- // scanner.setSource(s.toCharArray());
- // scanner.setPHPMode(true);
- // getNextToken();
- // do {
- // try {
- // if (token != TokenNameEOF && token != TokenNameERROR) {
- // statementList();
- // }
- // if (token != TokenNameEOF) {
- // if (token == TokenNameERROR) {
- // throwSyntaxError("Scanner error (Found unknown token: "
- // + scanner.toStringAction(token) + ")");
- // }
- // if (token == TokenNameRPAREN) {
- // throwSyntaxError("Too many closing ')'; end-of-file not reached.");
- // }
- // if (token == TokenNameRBRACE) {
- // throwSyntaxError("Too many closing '}'; end-of-file not reached.");
- // }
- // if (token == TokenNameRBRACKET) {
- // throwSyntaxError("Too many closing ']'; end-of-file not reached.");
- // }
- // if (token == TokenNameLPAREN) {
- // throwSyntaxError("Read character '('; end-of-file not reached.");
- // }
- // if (token == TokenNameLBRACE) {
- // throwSyntaxError("Read character '{'; end-of-file not reached.");
- // }
- // if (token == TokenNameLBRACKET) {
- // throwSyntaxError("Read character '['; end-of-file not reached.");
- // }
- // throwSyntaxError("End-of-file not reached.");
- // }
- // return;
- // } catch (SyntaxError err) {
- // if (s != null) {
- // throw err;
- // } else {
- // // setMarker(err.getMessage(), err.getLine(), ERROR);
- // // setMarker(err.getMessage(),
- // // scanner.getCurrentTokenStartPosition(),
- // // scanner.getCurrentTokenEndPosition(), ERROR);
- // }
- // // if an error occured,
- // // try to find keywords 'class' or 'function'
- // // to parse the rest of the string
- // while (token != TokenNameEOF && token != TokenNameERROR) {
- // if (token == TokenNameabstract || token == TokenNamefinal
- // || token == TokenNameclass || token == TokenNamefunction) {
- // break;
- // }
- // getNextToken();
- // }
- // if (token == TokenNameEOF || token == TokenNameERROR) {
- // return;
- // }
- // }
- // } while (true);
- // }
public void init(String s) {
this.str = s;
this.token = TokenNameEOF;
} else {
throwSyntaxError("'as' expected after 'foreach' exxpression.");
}
-// variable();
+ // variable();
foreach_variable();
foreach_optional_arg();
if (token == TokenNameEQUAL_GREATER) {
getNextToken();
}
}
-
private void foreach_variable() {
- // w_variable
- //| '&' w_variable
+ // w_variable
+ //| '&' w_variable
if (token == TokenNameAND) {
getNextToken();
}
w_variable();
}
private void foreach_optional_arg() {
- // /* empty */
- //| T_DOUBLE_ARROW foreach_variable
+ // /* empty */
+ //| T_DOUBLE_ARROW foreach_variable
if (token == TokenNameEQUAL_GREATER) {
getNextToken();
foreach_variable();
}
}
-
private void global_var_list() {
// global_var_list:
// global_var_list ',' global_var
// /* empty */
// | T_EXTENDS fully_qualified_class_name
if (token == TokenNameextends) {
- getNextToken();
- if (token == TokenNameIdentifier) {
- getNextToken();
- } else {
- throwSyntaxError("Class name expected after keyword 'extends'.",
- scanner.getCurrentTokenStartPosition(), scanner
- .getCurrentTokenEndPosition());
- }
+ interface_extends_list();
+ // getNextToken();
+ // if (token != TokenNameIdentifier) {
+ // throwSyntaxError("Class name expected after keyword 'extends'.",
+ // scanner.getCurrentTokenStartPosition(), scanner
+ // .getCurrentTokenEndPosition());
+ // }
}
implements_list();
} else {
// T_STRING
//| T_STRING_VARNAME
//| class_constant
- //| '"' encaps_list '"'
- //| '\'' encaps_list '\''
//| T_START_HEREDOC encaps_list T_END_HEREDOC
// | '`' encaps_list '`'
// | common_scalar
+ // | '`' encaps_list '`'
+ case TokenNameEncapsedString0 :
+ scanner.encapsedStringStack.push(new Character('`'));
+ getNextToken();
+ try {
+ if (token == TokenNameEncapsedString0) {
+ } else {
+ encaps_list();
+ if (token != TokenNameEncapsedString0) {
+ throwSyntaxError("\'`\' expected at end of string"
+ + "(Found token: " + scanner.toStringAction(token) + " )");
+ }
+ }
+ } finally {
+ scanner.encapsedStringStack.pop();
+ getNextToken();
+ }
+ break;
+ // | '\'' encaps_list '\''
+ case TokenNameEncapsedString1 :
+ scanner.encapsedStringStack.push(new Character('\''));
+ getNextToken();
+ try {
+ if (token == TokenNameEncapsedString1) {
+ } else {
+ encaps_list();
+ if (token != TokenNameEncapsedString1) {
+ throwSyntaxError("\'\'\' expected at end of string"
+ + "(Found token: " + scanner.toStringAction(token) + " )");
+ }
+ }
+ } finally {
+ scanner.encapsedStringStack.pop();
+ getNextToken();
+ }
+ break;
+ //| '"' encaps_list '"'
+ case TokenNameEncapsedString2 :
+ scanner.encapsedStringStack.push(new Character('"'));
+ getNextToken();
+ try {
+ if (token == TokenNameEncapsedString2) {
+ } else {
+ encaps_list();
+ if (token != TokenNameEncapsedString2) {
+ throwSyntaxError("'\"' expected at end of string"
+ + "(Found token: " + scanner.toStringAction(token) + " )");
+ }
+ }
+ } finally {
+ scanner.encapsedStringStack.pop();
+ getNextToken();
+ }
+ break;
case TokenNameIntegerLiteral :
case TokenNameDoubleLiteral :
case TokenNameStringLiteral :
if (token == TokenNameAND) {
getNextToken();
if (token == TokenNamenew) {
+ // | variable '=' '&' T_NEW class_name_reference ctor_arguments
getNextToken();
- throwSyntaxError("not yet implemented (= & new)");
- // class_name_reference();
- // ctor_arguments();
+ class_name_reference();
+ ctor_arguments();
} else {
variable();
}
//| expr T_DOUBLE_ARROW '&' w_variable
//| '&' w_variable
while (true) {
- expr();
if (token == TokenNameAND) {
getNextToken();
variable();
- return;
- } else if (token == TokenNameEQUAL_GREATER) {
- getNextToken();
+ } else {
+ expr();
if (token == TokenNameAND) {
getNextToken();
variable();
- } else {
- expr();
+ } else if (token == TokenNameEQUAL_GREATER) {
+ getNextToken();
+ if (token == TokenNameAND) {
+ getNextToken();
+ variable();
+ } else {
+ expr();
+ }
}
}
if (token != TokenNameCOMMA) {
if (Scanner.TRACE) {
System.out.println("TRACE: base_variable_with_function_calls()");
}
- if (token == TokenNameIdentifier) {
- functionCall = true;
- } else if (token == TokenNameVariable) {
- int tempToken = token;
- int tempPosition = scanner.currentPosition;
- getNextToken();
- if (token == TokenNameLPAREN) {
- functionCall = true;
- }
- token = tempToken;
- scanner.currentPosition = tempPosition;
- scanner.phpMode = true;
- }
- if (functionCall) {
- function_call();
- } else {
- base_variable();
- }
+ // if (token == TokenNameIdentifier) {
+ // functionCall = true;
+ // } else if (token == TokenNameVariable) {
+ // int tempToken = token;
+ // int tempPosition = scanner.currentPosition;
+ // getNextToken();
+ // if (token == TokenNameLPAREN) {
+ // functionCall = true;
+ // }
+ // token = tempToken;
+ // scanner.currentPosition = tempPosition;
+ // scanner.phpMode = true;
+ // }
+ // if (functionCall) {
+ function_call();
+ // } else {
+ // base_variable();
+ // }
}
private void base_variable() {
// base_variable:
if (token != TokenNameRBRACE) {
throwSyntaxError("'}' expected in variable name.");
}
+ getNextToken();
}
}
private void r_variable() {
}
getNextToken();
}
+ private void encaps_list() {
+ // encaps_list encaps_var
+ // | encaps_list T_STRING
+ // | encaps_list T_NUM_STRING
+ // | encaps_list T_ENCAPSED_AND_WHITESPACE
+ // | encaps_list T_CHARACTER
+ // | encaps_list T_BAD_CHARACTER
+ // | encaps_list '['
+ // | encaps_list ']'
+ // | encaps_list '{'
+ // | encaps_list '}'
+ // | encaps_list T_OBJECT_OPERATOR
+ // | /* empty */
+ while (true) {
+ switch (token) {
+ case TokenNameSTRING :
+ getNextToken();
+ break;
+ case TokenNameLBRACE :
+ // scanner.encapsedStringStack.pop();
+ getNextToken();
+ break;
+ case TokenNameRBRACE :
+ // scanner.encapsedStringStack.pop();
+ getNextToken();
+ break;
+ case TokenNameLBRACKET :
+ // scanner.encapsedStringStack.pop();
+ getNextToken();
+ break;
+ case TokenNameRBRACKET :
+ // scanner.encapsedStringStack.pop();
+ getNextToken();
+ break;
+ case TokenNameMINUS_GREATER :
+ // scanner.encapsedStringStack.pop();
+ getNextToken();
+ break;
+ case TokenNameVariable :
+ case TokenNameDOLLAR_LBRACE :
+ case TokenNameCURLY_OPEN :
+ encaps_var();
+ break;
+ // case TokenNameDOLLAR :
+ // getNextToken();
+ // if (token == TokenNameLBRACE) {
+ // token = TokenNameDOLLAR_LBRACE;
+ // encaps_var();
+ // }
+ // break;
+ default :
+ char encapsedChar = ((Character) scanner.encapsedStringStack.peek())
+ .charValue();
+ if (encapsedChar == '$') {
+ scanner.encapsedStringStack.pop();
+ encapsedChar = ((Character) scanner.encapsedStringStack.peek())
+ .charValue();
+ switch (encapsedChar) {
+ case '`' :
+ if (token == TokenNameEncapsedString0) {
+ return;
+ }
+ token = TokenNameSTRING;
+ continue;
+ case '\'' :
+ if (token == TokenNameEncapsedString1) {
+ return;
+ }
+ token = TokenNameSTRING;
+ continue;
+ case '"' :
+ if (token == TokenNameEncapsedString2) {
+ return;
+ }
+ token = TokenNameSTRING;
+ continue;
+ }
+ }
+ return;
+ }
+ }
+ }
+ private void encaps_var() {
+ // T_VARIABLE
+ // | T_VARIABLE '[' encaps_var_offset ']'
+ // | T_VARIABLE T_OBJECT_OPERATOR T_STRING
+ // | T_DOLLAR_OPEN_CURLY_BRACES expr '}'
+ // | T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr ']' '}'
+ // | T_CURLY_OPEN variable '}'
+ switch (token) {
+ case TokenNameVariable :
+ getNextToken();
+ if (token == TokenNameLBRACKET) {
+ getNextToken();
+ // if (token == TokenNameRBRACKET) {
+ // getNextToken();
+ // } else {
+ expr(); //encaps_var_offset();
+ if (token != TokenNameRBRACKET) {
+ throwSyntaxError("']' expected after variable.");
+ }
+ // scanner.encapsedStringStack.pop();
+ getNextToken();
+ // }
+ } else if (token == TokenNameMINUS_GREATER) {
+ getNextToken();
+ if (token != TokenNameIdentifier) {
+ throwSyntaxError("Identifier expected after '->'.");
+ }
+ // scanner.encapsedStringStack.pop();
+ getNextToken();
+ }
+ // else {
+ // // scanner.encapsedStringStack.pop();
+ // int tempToken = TokenNameSTRING;
+ // if (!scanner.encapsedStringStack.isEmpty()
+ // && (token == TokenNameEncapsedString0
+ // || token == TokenNameEncapsedString1
+ // || token == TokenNameEncapsedString2 || token == TokenNameERROR)) {
+ // char encapsedChar = ((Character) scanner.encapsedStringStack.peek())
+ // .charValue();
+ // switch (token) {
+ // case TokenNameEncapsedString0 :
+ // if (encapsedChar == '`') {
+ // tempToken = TokenNameEncapsedString0;
+ // }
+ // break;
+ // case TokenNameEncapsedString1 :
+ // if (encapsedChar == '\'') {
+ // tempToken = TokenNameEncapsedString1;
+ // }
+ // break;
+ // case TokenNameEncapsedString2 :
+ // if (encapsedChar == '"') {
+ // tempToken = TokenNameEncapsedString2;
+ // }
+ // break;
+ // case TokenNameERROR :
+ // if (scanner.source[scanner.currentPosition - 1] == '\\') {
+ // scanner.currentPosition--;
+ // getNextToken();
+ // }
+ // break;
+ // }
+ // }
+ // token = tempToken;
+ // }
+ break;
+ case TokenNameDOLLAR_LBRACE :
+ getNextToken();
+ if (token == TokenNameIdentifier) {
+ getNextToken();
+ if (token == TokenNameLBRACKET) {
+ getNextToken();
+ // if (token == TokenNameRBRACKET) {
+ // getNextToken();
+ // } else {
+ expr();
+ if (token != TokenNameRBRACKET) {
+ throwSyntaxError("']' expected after '${'.");
+ }
+ getNextToken();
+ // }
+ }
+ if (token != TokenNameRBRACE) {
+ throwSyntaxError("'}' expected after '${'.");
+ }
+ // scanner.encapsedStringStack.pop();
+ getNextToken();
+ } else {
+ expr();
+ if (token != TokenNameRBRACE) {
+ throwSyntaxError("'}' expected.");
+ }
+ // scanner.encapsedStringStack.pop();
+ getNextToken();
+ }
+ break;
+ case TokenNameCURLY_OPEN :
+ getNextToken();
+ if (token == TokenNameIdentifier) {
+ getNextToken();
+ if (token == TokenNameLBRACKET) {
+ getNextToken();
+ // if (token == TokenNameRBRACKET) {
+ // getNextToken();
+ // } else {
+ expr();
+ if (token != TokenNameRBRACKET) {
+ throwSyntaxError("']' expected after '{$'.");
+ }
+ getNextToken();
+ // }
+ } else if (token == TokenNameMINUS_GREATER) {
+ getNextToken();
+ if (token != TokenNameIdentifier) {
+ throwSyntaxError("String token expected.");
+ }
+ getNextToken();
+ }
+ // if (token != TokenNameRBRACE) {
+ // throwSyntaxError("'}' expected after '{$'.");
+ // }
+ // // scanner.encapsedStringStack.pop();
+ // getNextToken();
+ } else {
+ expr();
+ if (token != TokenNameRBRACE) {
+ throwSyntaxError("'}' expected.");
+ }
+ // scanner.encapsedStringStack.pop();
+ getNextToken();
+ }
+ break;
+ }
+ }
+ private void encaps_var_offset() {
+ // T_STRING
+ // | T_NUM_STRING
+ // | T_VARIABLE
+ switch (token) {
+ case TokenNameSTRING :
+ getNextToken();
+ break;
+ case TokenNameIntegerLiteral :
+ getNextToken();
+ break;
+ case TokenNameVariable :
+ getNextToken();
+ break;
+ case TokenNameIdentifier :
+ getNextToken();
+ break;
+ default :
+ throwSyntaxError("Variable or String token expected.");
+ break;
+ }
+ }
private void internal_functions_in_yacc() {
switch (token) {
case TokenNameisset :
}
}
break;
+ case TokenNameEncapsedString0 :
+ try {
+ scanner.currentCharacter = scanner.source[scanner.currentPosition++];
+ while (scanner.currentCharacter != '`') {
+ if (scanner.currentCharacter == '\\') {
+ scanner.currentPosition++;
+ }
+ scanner.currentCharacter = scanner.source[scanner.currentPosition++];
+ }
+ getNextToken();
+ } catch (IndexOutOfBoundsException e) {
+ throwSyntaxError("'`' expected at end of static string.");
+ }
+ break;
+ case TokenNameEncapsedString1 :
+ try {
+ scanner.currentCharacter = scanner.source[scanner.currentPosition++];
+ while (scanner.currentCharacter != '\'') {
+ if (scanner.currentCharacter == '\\') {
+ scanner.currentPosition++;
+ }
+ scanner.currentCharacter = scanner.source[scanner.currentPosition++];
+ }
+ getNextToken();
+ } catch (IndexOutOfBoundsException e) {
+ throwSyntaxError("'\'' expected at end of static string.");
+ }
+ break;
+ case TokenNameEncapsedString2 :
+ try {
+ scanner.currentCharacter = scanner.source[scanner.currentPosition++];
+ while (scanner.currentCharacter != '"') {
+ if (scanner.currentCharacter == '\\') {
+ scanner.currentPosition++;
+ }
+ scanner.currentCharacter = scanner.source[scanner.currentPosition++];
+ }
+ getNextToken();
+ } catch (IndexOutOfBoundsException e) {
+ throwSyntaxError("'\"' expected at end of static string.");
+ }
+ break;
case TokenNamePLUS :
getNextToken();
static_scalar();
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import java.util.Stack;
import net.sourceforge.phpdt.core.compiler.CharOperation;
import net.sourceforge.phpdt.core.compiler.IScanner;
import net.sourceforge.phpdt.core.compiler.ITerminalSymbols;
public boolean containsAssertKeyword = false;
public boolean recordLineSeparator;
public boolean phpMode = false;
+ public Stack encapsedStringStack = null;
public char currentCharacter;
public int startPosition;
public int currentPosition;
public int[][] foundTaskPositions;
public int foundTaskCount = 0;
public char[][] taskTags = null;
- public char[][] taskPriorities = null;
+ public char[][] taskPriorities = null;
public static final boolean DEBUG = false;
public static final boolean TRACE = false;
public Scanner() {
return currentPosition > source.length ? TokenNameEOF : TokenNameRBRACE;
}
try {
- while (true) { //loop for jumping over comments
+ while (true) {
withoutUnicodePtr = 0;
- //start with a new token (even comment written with unicode )
+ //start with a new token
+ char encapsedChar = ' ';
+ if (!encapsedStringStack.isEmpty()) {
+ encapsedChar = ((Character) encapsedStringStack.peek()).charValue();
+ }
+ if (encapsedChar != '$' && encapsedChar != ' ') {
+ currentCharacter = source[currentPosition++];
+ if (currentCharacter == encapsedChar) {
+ switch (currentCharacter) {
+ case '`' :
+ return TokenNameEncapsedString0;
+ case '\'' :
+ return TokenNameEncapsedString1;
+ case '"' :
+ return TokenNameEncapsedString2;
+ }
+ }
+ while (currentCharacter != encapsedChar) {
+ /** ** in PHP \r and \n are valid in string literals *** */
+ switch (currentCharacter) {
+ case '\\' :
+ int escapeSize = currentPosition;
+ boolean backSlashAsUnicodeInString = unicodeAsBackSlash;
+ //scanEscapeCharacter make a side effect on this value and
+ // we need the previous value few lines down this one
+ scanDoubleQuotedEscapeCharacter();
+ escapeSize = currentPosition - escapeSize;
+ if (withoutUnicodePtr == 0) {
+ //buffer all the entries that have been left aside....
+ withoutUnicodePtr = currentPosition - escapeSize - 1
+ - startPosition;
+ System.arraycopy(source, startPosition,
+ withoutUnicodeBuffer, 1, withoutUnicodePtr);
+ withoutUnicodeBuffer[++withoutUnicodePtr] = currentCharacter;
+ } else { //overwrite the / in the buffer
+ withoutUnicodeBuffer[withoutUnicodePtr] = currentCharacter;
+ if (backSlashAsUnicodeInString) { //there are TWO \ in
+ withoutUnicodePtr--;
+ }
+ }
+ break;
+ case '$' :
+ if (isPHPIdentifierStart(source[currentPosition])
+ || source[currentPosition] == '{') {
+ currentPosition--;
+ encapsedStringStack.push(new Character('$'));
+ return TokenNameSTRING;
+ }
+ break;
+ case '{' :
+ if (source[currentPosition] == '$') { // CURLY_OPEN
+ currentPosition--;
+ encapsedStringStack.push(new Character('$'));
+ return TokenNameSTRING;
+ }
+ }
+ // consume next character
+ unicodeAsBackSlash = false;
+ currentCharacter = source[currentPosition++];
+ if (withoutUnicodePtr != 0) {
+ withoutUnicodeBuffer[++withoutUnicodePtr] = currentCharacter;
+ }
+ // }
+ } // end while
+ currentPosition--;
+ return TokenNameSTRING;
+ }
// ---------Consume white space and handles startPosition---------
int whiteStart = currentPosition;
- boolean isWhiteSpace;
- do {
+ startPosition = currentPosition;
+ currentCharacter = source[currentPosition++];
+ if (encapsedChar == '$') {
+ switch (currentCharacter) {
+ case '\\' :
+ currentCharacter = source[currentPosition++];
+ return TokenNameSTRING;
+ case '{' :
+ if (encapsedChar == '$') {
+ if (getNextChar('$'))
+ return TokenNameCURLY_OPEN;
+ }
+ return TokenNameLBRACE;
+ case '}' :
+ return TokenNameRBRACE;
+ case '[' :
+ return TokenNameLBRACKET;
+ case ']' :
+ return TokenNameRBRACKET;
+ case '\'' :
+ return TokenNameEncapsedString1;
+ case '"' :
+ return TokenNameEncapsedString2;
+ case '`' :
+ return TokenNameEncapsedString0;
+ case '-' :
+ if (getNextChar('>'))
+ return TokenNameMINUS_GREATER;
+ return TokenNameSTRING;
+ default :
+ if (currentCharacter == '$') {
+ int oldPosition = currentPosition;
+ try {
+ currentCharacter = source[currentPosition++];
+ if (currentCharacter == '{') {
+ return TokenNameDOLLAR_LBRACE;
+ }
+ if (isPHPIdentifierStart(currentCharacter)) {
+ return scanIdentifierOrKeyword(true);
+ } else {
+ currentPosition = oldPosition;
+ return TokenNameSTRING;
+ }
+ } catch (IndexOutOfBoundsException e) {
+ currentPosition = oldPosition;
+ return TokenNameSTRING;
+ }
+ }
+ if (isPHPIdentifierStart(currentCharacter))
+ return scanIdentifierOrKeyword(false);
+ if (Character.isDigit(currentCharacter))
+ return scanNumber(false);
+ return TokenNameERROR;
+ }
+ }
+// boolean isWhiteSpace;
+ while ((currentCharacter == ' ')
+ || Character.isWhitespace(currentCharacter)) {
startPosition = currentPosition;
currentCharacter = source[currentPosition++];
// if (((currentCharacter = source[currentPosition++]) == '\\')
currentLine = null;
}
}
- isWhiteSpace = (currentCharacter == ' ')
- || Character.isWhitespace(currentCharacter);
+// isWhiteSpace = (currentCharacter == ' ')
+// || Character.isWhitespace(currentCharacter);
// }
- } while (isWhiteSpace);
+ }
if (tokenizeWhiteSpace && (whiteStart != currentPosition - 1)) {
// reposition scanner in case we are interested by spaces as tokens
currentPosition--;
//little trick to get out in the middle of a source compuation
if (currentPosition > eofPosition)
return TokenNameEOF;
- // ---------Identify the next token-------------
- switch (currentCharacter) {
- case '(' :
- return getCastOrParen();
- case ')' :
- return TokenNameRPAREN;
- case '{' :
- return TokenNameLBRACE;
- case '}' :
- return TokenNameRBRACE;
- case '[' :
- return TokenNameLBRACKET;
- case ']' :
- return TokenNameRBRACKET;
- case ';' :
- return TokenNameSEMICOLON;
- case ',' :
- return TokenNameCOMMA;
- case '.' :
- if (getNextChar('='))
- return TokenNameDOT_EQUAL;
- if (getNextCharAsDigit())
- return scanNumber(true);
- return TokenNameDOT;
- case '+' :
- {
- int test;
- if ((test = getNextChar('+', '=')) == 0)
- return TokenNamePLUS_PLUS;
- if (test > 0)
- return TokenNamePLUS_EQUAL;
- return TokenNamePLUS;
- }
- case '-' :
- {
- int test;
- if ((test = getNextChar('-', '=')) == 0)
- return TokenNameMINUS_MINUS;
- if (test > 0)
- return TokenNameMINUS_EQUAL;
- if (getNextChar('>'))
- return TokenNameMINUS_GREATER;
- return TokenNameMINUS;
- }
- case '~' :
- if (getNextChar('='))
- return TokenNameTWIDDLE_EQUAL;
- return TokenNameTWIDDLE;
- case '!' :
- if (getNextChar('=')) {
- if (getNextChar('=')) {
- return TokenNameNOT_EQUAL_EQUAL;
+
+ // ---------Identify the next token-------------
+ switch (currentCharacter) {
+ case '(' :
+ return getCastOrParen();
+ case ')' :
+ return TokenNameRPAREN;
+ case '{' :
+ return TokenNameLBRACE;
+ case '}' :
+ return TokenNameRBRACE;
+ case '[' :
+ return TokenNameLBRACKET;
+ case ']' :
+ return TokenNameRBRACKET;
+ case ';' :
+ return TokenNameSEMICOLON;
+ case ',' :
+ return TokenNameCOMMA;
+ case '.' :
+ if (getNextChar('='))
+ return TokenNameDOT_EQUAL;
+ if (getNextCharAsDigit())
+ return scanNumber(true);
+ return TokenNameDOT;
+ case '+' :
+ {
+ int test;
+ if ((test = getNextChar('+', '=')) == 0)
+ return TokenNamePLUS_PLUS;
+ if (test > 0)
+ return TokenNamePLUS_EQUAL;
+ return TokenNamePLUS;
}
- return TokenNameNOT_EQUAL;
- }
- return TokenNameNOT;
- case '*' :
- if (getNextChar('='))
- return TokenNameMULTIPLY_EQUAL;
- return TokenNameMULTIPLY;
- case '%' :
- if (getNextChar('='))
- return TokenNameREMAINDER_EQUAL;
- return TokenNameREMAINDER;
- case '<' :
+ case '-' :
{
- int oldPosition = currentPosition;
- try {
- currentCharacter = source[currentPosition++];
- } catch (IndexOutOfBoundsException e) {
- currentPosition = oldPosition;
- return TokenNameLESS;
+ int test;
+ if ((test = getNextChar('-', '=')) == 0)
+ return TokenNameMINUS_MINUS;
+ if (test > 0)
+ return TokenNameMINUS_EQUAL;
+ if (getNextChar('>'))
+ return TokenNameMINUS_GREATER;
+ return TokenNameMINUS;
+ }
+ case '~' :
+ if (getNextChar('='))
+ return TokenNameTWIDDLE_EQUAL;
+ return TokenNameTWIDDLE;
+ case '!' :
+ if (getNextChar('=')) {
+ if (getNextChar('=')) {
+ return TokenNameNOT_EQUAL_EQUAL;
+ }
+ return TokenNameNOT_EQUAL;
}
- switch (currentCharacter) {
- case '=' :
- return TokenNameLESS_EQUAL;
- case '>' :
- return TokenNameNOT_EQUAL;
- case '<' :
- if (getNextChar('='))
- return TokenNameLEFT_SHIFT_EQUAL;
- if (getNextChar('<')) {
- int heredocStart = currentPosition;
- int heredocLength = 0;
- currentCharacter = source[currentPosition++];
- if (isPHPIdentifierStart(currentCharacter)) {
- currentCharacter = source[currentPosition++];
- } else {
- return TokenNameERROR;
- }
- while (isPHPIdentifierPart(currentCharacter)) {
+ return TokenNameNOT;
+ case '*' :
+ if (getNextChar('='))
+ return TokenNameMULTIPLY_EQUAL;
+ return TokenNameMULTIPLY;
+ case '%' :
+ if (getNextChar('='))
+ return TokenNameREMAINDER_EQUAL;
+ return TokenNameREMAINDER;
+ case '<' :
+ {
+ int oldPosition = currentPosition;
+ try {
+ currentCharacter = source[currentPosition++];
+ } catch (IndexOutOfBoundsException e) {
+ currentPosition = oldPosition;
+ return TokenNameLESS;
+ }
+ switch (currentCharacter) {
+ case '=' :
+ return TokenNameLESS_EQUAL;
+ case '>' :
+ return TokenNameNOT_EQUAL;
+ case '<' :
+ if (getNextChar('='))
+ return TokenNameLEFT_SHIFT_EQUAL;
+ if (getNextChar('<')) {
currentCharacter = source[currentPosition++];
- }
- heredocLength = currentPosition - heredocStart - 1;
- // heredoc end-tag determination
- boolean endTag = true;
- char ch;
- do {
- ch = source[currentPosition++];
- if (ch == '\r' || ch == '\n') {
- if (recordLineSeparator) {
- pushLineSeparator();
- } else {
- currentLine = null;
- }
- for (int i = 0; i < heredocLength; i++) {
- if (source[currentPosition + i] != source[heredocStart
- + i]) {
- endTag = false;
- break;
+ while (Character.isWhitespace(currentCharacter)) {
+ currentCharacter = source[currentPosition++];
+ }
+ int heredocStart = currentPosition - 1;
+ int heredocLength = 0;
+ if (isPHPIdentifierStart(currentCharacter)) {
+ currentCharacter = source[currentPosition++];
+ } else {
+ return TokenNameERROR;
+ }
+ while (isPHPIdentifierPart(currentCharacter)) {
+ currentCharacter = source[currentPosition++];
+ }
+ heredocLength = currentPosition - heredocStart - 1;
+ // heredoc end-tag determination
+ boolean endTag = true;
+ char ch;
+ do {
+ ch = source[currentPosition++];
+ if (ch == '\r' || ch == '\n') {
+ if (recordLineSeparator) {
+ pushLineSeparator();
+ } else {
+ currentLine = null;
+ }
+ for (int i = 0; i < heredocLength; i++) {
+ if (source[currentPosition + i] != source[heredocStart
+ + i]) {
+ endTag = false;
+ break;
+ }
+ }
+ if (endTag) {
+ currentPosition += heredocLength - 1;
+ currentCharacter = source[currentPosition++];
+ break; // do...while loop
+ } else {
+ endTag = true;
}
}
- if (endTag) {
- currentPosition += heredocLength - 1;
- currentCharacter = source[currentPosition++];
- break; // do...while loop
- } else {
- endTag = true;
- }
- }
- } while (true);
- return TokenNameHEREDOC;
- }
- return TokenNameLEFT_SHIFT;
+ } while (true);
+ return TokenNameHEREDOC;
+ }
+ return TokenNameLEFT_SHIFT;
+ }
+ currentPosition = oldPosition;
+ return TokenNameLESS;
}
- currentPosition = oldPosition;
- return TokenNameLESS;
- }
- case '>' :
- {
- int test;
- if ((test = getNextChar('=', '>')) == 0)
- return TokenNameGREATER_EQUAL;
- if (test > 0) {
+ case '>' :
+ {
+ int test;
if ((test = getNextChar('=', '>')) == 0)
- return TokenNameRIGHT_SHIFT_EQUAL;
- return TokenNameRIGHT_SHIFT;
+ return TokenNameGREATER_EQUAL;
+ if (test > 0) {
+ if ((test = getNextChar('=', '>')) == 0)
+ return TokenNameRIGHT_SHIFT_EQUAL;
+ return TokenNameRIGHT_SHIFT;
+ }
+ return TokenNameGREATER;
}
- return TokenNameGREATER;
- }
- case '=' :
- if (getNextChar('=')) {
+ case '=' :
if (getNextChar('=')) {
- return TokenNameEQUAL_EQUAL_EQUAL;
- }
- return TokenNameEQUAL_EQUAL;
- }
- if (getNextChar('>'))
- return TokenNameEQUAL_GREATER;
- return TokenNameEQUAL;
- case '&' :
- {
- int test;
- if ((test = getNextChar('&', '=')) == 0)
- return TokenNameAND_AND;
- if (test > 0)
- return TokenNameAND_EQUAL;
- return TokenNameAND;
- }
- case '|' :
- {
- int test;
- if ((test = getNextChar('|', '=')) == 0)
- return TokenNameOR_OR;
- if (test > 0)
- return TokenNameOR_EQUAL;
- return TokenNameOR;
- }
- case '^' :
- if (getNextChar('='))
- return TokenNameXOR_EQUAL;
- return TokenNameXOR;
- case '?' :
- if (getNextChar('>')) {
- phpMode = false;
- if (currentPosition==source.length) {
- phpMode = true;
- return TokenNameINLINE_HTML;
- }
- return getInlinedHTML(currentPosition - 2);
- }
- return TokenNameQUESTION;
- case ':' :
- if (getNextChar(':'))
- return TokenNamePAAMAYIM_NEKUDOTAYIM;
- return TokenNameCOLON;
- case '@' :
- return TokenNameAT;
- // case '\'' :
- // {
- // int test;
- // if ((test = getNextChar('\n', '\r')) == 0) {
- // throw new InvalidInputException(INVALID_CHARACTER_CONSTANT);
- // }
- // if (test > 0) {
- // // relocate if finding another quote fairly close: thus unicode
- // '/u000D' will be fully consumed
- // for (int lookAhead = 0;
- // lookAhead < 3;
- // lookAhead++) {
- // if (currentPosition + lookAhead
- // == source.length)
- // break;
- // if (source[currentPosition + lookAhead]
- // == '\n')
- // break;
- // if (source[currentPosition + lookAhead]
- // == '\'') {
- // currentPosition += lookAhead + 1;
- // break;
- // }
- // }
- // throw new InvalidInputException(INVALID_CHARACTER_CONSTANT);
- // }
- // }
- // if (getNextChar('\'')) {
- // // relocate if finding another quote fairly close: thus unicode
- // '/u000D' will be fully consumed
- // for (int lookAhead = 0;
- // lookAhead < 3;
- // lookAhead++) {
- // if (currentPosition + lookAhead
- // == source.length)
- // break;
- // if (source[currentPosition + lookAhead]
- // == '\n')
- // break;
- // if (source[currentPosition + lookAhead]
- // == '\'') {
- // currentPosition += lookAhead + 1;
- // break;
- // }
- // }
- // throw new InvalidInputException(INVALID_CHARACTER_CONSTANT);
- // }
- // if (getNextChar('\\'))
- // scanEscapeCharacter();
- // else { // consume next character
- // unicodeAsBackSlash = false;
- // if (((currentCharacter = source[currentPosition++])
- // == '\\')
- // && (source[currentPosition] == 'u')) {
- // getNextUnicodeChar();
- // } else {
- // if (withoutUnicodePtr != 0) {
- // withoutUnicodeBuffer[++withoutUnicodePtr] =
- // currentCharacter;
- // }
- // }
- // }
- // // if (getNextChar('\''))
- // // return TokenNameCharacterLiteral;
- // // relocate if finding another quote fairly close: thus unicode
- // '/u000D' will be fully consumed
- // for (int lookAhead = 0; lookAhead < 20; lookAhead++) {
- // if (currentPosition + lookAhead == source.length)
- // break;
- // if (source[currentPosition + lookAhead] == '\n')
- // break;
- // if (source[currentPosition + lookAhead] == '\'') {
- // currentPosition += lookAhead + 1;
- // break;
- // }
- // }
- // throw new InvalidInputException(INVALID_CHARACTER_CONSTANT);
- case '\'' :
- try {
- // consume next character
- unicodeAsBackSlash = false;
- currentCharacter = source[currentPosition++];
- // if (((currentCharacter = source[currentPosition++]) == '\\')
- // && (source[currentPosition] == 'u')) {
- // getNextUnicodeChar();
- // } else {
- // if (withoutUnicodePtr != 0) {
- // withoutUnicodeBuffer[++withoutUnicodePtr] =
- // currentCharacter;
- // }
- // }
- while (currentCharacter != '\'') {
- /** ** in PHP \r and \n are valid in string literals *** */
- // if ((currentCharacter == '\n')
- // || (currentCharacter == '\r')) {
- // // relocate if finding another quote fairly close: thus
- // unicode '/u000D' will be fully consumed
- // for (int lookAhead = 0; lookAhead < 50; lookAhead++) {
- // if (currentPosition + lookAhead == source.length)
- // break;
- // if (source[currentPosition + lookAhead] == '\n')
- // break;
- // if (source[currentPosition + lookAhead] == '\"') {
- // currentPosition += lookAhead + 1;
- // break;
- // }
- // }
- // throw new InvalidInputException(INVALID_CHAR_IN_STRING);
- // }
- if (currentCharacter == '\\') {
- int escapeSize = currentPosition;
- boolean backSlashAsUnicodeInString = unicodeAsBackSlash;
- //scanEscapeCharacter make a side effect on this value and
- // we need the previous value few lines down this one
- scanSingleQuotedEscapeCharacter();
- escapeSize = currentPosition - escapeSize;
- if (withoutUnicodePtr == 0) {
- //buffer all the entries that have been left aside....
- withoutUnicodePtr = currentPosition - escapeSize - 1
- - startPosition;
- System.arraycopy(source, startPosition,
- withoutUnicodeBuffer, 1, withoutUnicodePtr);
- withoutUnicodeBuffer[++withoutUnicodePtr] = currentCharacter;
- } else { //overwrite the / in the buffer
- withoutUnicodeBuffer[withoutUnicodePtr] = currentCharacter;
- if (backSlashAsUnicodeInString) { //there are TWO \ in
- // the stream where
- // only one is correct
- withoutUnicodePtr--;
- }
- }
+ if (getNextChar('=')) {
+ return TokenNameEQUAL_EQUAL_EQUAL;
}
- // consume next character
- unicodeAsBackSlash = false;
- currentCharacter = source[currentPosition++];
- // if (((currentCharacter = source[currentPosition++]) ==
- // '\\')
- // && (source[currentPosition] == 'u')) {
- // getNextUnicodeChar();
- // } else {
- if (withoutUnicodePtr != 0) {
- withoutUnicodeBuffer[++withoutUnicodePtr] = currentCharacter;
- }
- // }
+ return TokenNameEQUAL_EQUAL;
}
- } catch (IndexOutOfBoundsException e) {
- throw new InvalidInputException(UNTERMINATED_STRING);
- } catch (InvalidInputException e) {
- if (e.getMessage().equals(INVALID_ESCAPE)) {
- // relocate if finding another quote fairly close: thus
- // unicode '/u000D' will be fully consumed
- for (int lookAhead = 0; lookAhead < 50; lookAhead++) {
- if (currentPosition + lookAhead == source.length)
- break;
- if (source[currentPosition + lookAhead] == '\n')
- break;
- if (source[currentPosition + lookAhead] == '\'') {
- currentPosition += lookAhead + 1;
- break;
- }
- }
+ if (getNextChar('>'))
+ return TokenNameEQUAL_GREATER;
+ return TokenNameEQUAL;
+ case '&' :
+ {
+ int test;
+ if ((test = getNextChar('&', '=')) == 0)
+ return TokenNameAND_AND;
+ if (test > 0)
+ return TokenNameAND_EQUAL;
+ return TokenNameAND;
}
- throw e; // rethrow
- }
- if (checkNonExternalizedStringLiterals) { // check for presence
- // of NLS tags
- // //$NON-NLS-?$ where
- // ? is an int.
- if (currentLine == null) {
- currentLine = new NLSLine();
- lines.add(currentLine);
+ case '|' :
+ {
+ int test;
+ if ((test = getNextChar('|', '=')) == 0)
+ return TokenNameOR_OR;
+ if (test > 0)
+ return TokenNameOR_EQUAL;
+ return TokenNameOR;
}
- currentLine.add(new StringLiteral(
- getCurrentTokenSourceString(), startPosition,
- currentPosition - 1));
- }
- return TokenNameStringConstant;
- case '"' :
- try {
- // consume next character
- unicodeAsBackSlash = false;
- currentCharacter = source[currentPosition++];
- // if (((currentCharacter = source[currentPosition++]) == '\\')
- // && (source[currentPosition] == 'u')) {
- // getNextUnicodeChar();
- // } else {
- // if (withoutUnicodePtr != 0) {
- // withoutUnicodeBuffer[++withoutUnicodePtr] =
- // currentCharacter;
- // }
- // }
- while (currentCharacter != '"') {
- /** ** in PHP \r and \n are valid in string literals *** */
- // if ((currentCharacter == '\n')
- // || (currentCharacter == '\r')) {
- // // relocate if finding another quote fairly close: thus
- // unicode '/u000D' will be fully consumed
- // for (int lookAhead = 0; lookAhead < 50; lookAhead++) {
- // if (currentPosition + lookAhead == source.length)
- // break;
- // if (source[currentPosition + lookAhead] == '\n')
- // break;
- // if (source[currentPosition + lookAhead] == '\"') {
- // currentPosition += lookAhead + 1;
- // break;
- // }
- // }
- // throw new InvalidInputException(INVALID_CHAR_IN_STRING);
- // }
- if (currentCharacter == '\\') {
- int escapeSize = currentPosition;
- boolean backSlashAsUnicodeInString = unicodeAsBackSlash;
- //scanEscapeCharacter make a side effect on this value and
- // we need the previous value few lines down this one
- scanDoubleQuotedEscapeCharacter();
- escapeSize = currentPosition - escapeSize;
- if (withoutUnicodePtr == 0) {
- //buffer all the entries that have been left aside....
- withoutUnicodePtr = currentPosition - escapeSize - 1
- - startPosition;
- System.arraycopy(source, startPosition,
- withoutUnicodeBuffer, 1, withoutUnicodePtr);
- withoutUnicodeBuffer[++withoutUnicodePtr] = currentCharacter;
- } else { //overwrite the / in the buffer
- withoutUnicodeBuffer[withoutUnicodePtr] = currentCharacter;
- if (backSlashAsUnicodeInString) { //there are TWO \ in
- // the stream where
- // only one is correct
- withoutUnicodePtr--;
- }
- }
+ case '^' :
+ if (getNextChar('='))
+ return TokenNameXOR_EQUAL;
+ return TokenNameXOR;
+ case '?' :
+ if (getNextChar('>')) {
+ phpMode = false;
+ if (currentPosition == source.length) {
+ phpMode = true;
+ return TokenNameINLINE_HTML;
}
+ return getInlinedHTML(currentPosition - 2);
+ }
+ return TokenNameQUESTION;
+ case ':' :
+ if (getNextChar(':'))
+ return TokenNamePAAMAYIM_NEKUDOTAYIM;
+ return TokenNameCOLON;
+ case '@' :
+ return TokenNameAT;
+ case '\'' :
+// return TokenNameEncapsedString1;
+ try {
// consume next character
unicodeAsBackSlash = false;
currentCharacter = source[currentPosition++];
- // if (((currentCharacter = source[currentPosition++]) ==
- // '\\')
- // && (source[currentPosition] == 'u')) {
- // getNextUnicodeChar();
- // } else {
- if (withoutUnicodePtr != 0) {
- withoutUnicodeBuffer[++withoutUnicodePtr] = currentCharacter;
- }
+ // if (((currentCharacter = source[currentPosition++]) == '\\')
+ // && (source[currentPosition] == 'u')) {
+ // getNextUnicodeChar();
+ // } else {
+ // if (withoutUnicodePtr != 0) {
+ // withoutUnicodeBuffer[++withoutUnicodePtr] =
+ // currentCharacter;
// }
- }
- } catch (IndexOutOfBoundsException e) {
- throw new InvalidInputException(UNTERMINATED_STRING);
- } catch (InvalidInputException e) {
- if (e.getMessage().equals(INVALID_ESCAPE)) {
- // relocate if finding another quote fairly close: thus
- // unicode '/u000D' will be fully consumed
- for (int lookAhead = 0; lookAhead < 50; lookAhead++) {
- if (currentPosition + lookAhead == source.length)
- break;
- if (source[currentPosition + lookAhead] == '\n')
- break;
- if (source[currentPosition + lookAhead] == '\"') {
- currentPosition += lookAhead + 1;
- break;
- }
- }
- }
- throw e; // rethrow
- }
- if (checkNonExternalizedStringLiterals) { // check for presence
- // of NLS tags
- // //$NON-NLS-?$ where
- // ? is an int.
- if (currentLine == null) {
- currentLine = new NLSLine();
- lines.add(currentLine);
- }
- currentLine.add(new StringLiteral(
- getCurrentTokenSourceString(), startPosition,
- currentPosition - 1));
- }
- return TokenNameStringLiteral;
- case '`' :
- try {
- // consume next character
- unicodeAsBackSlash = false;
- currentCharacter = source[currentPosition++];
- // if (((currentCharacter = source[currentPosition++]) == '\\')
- // && (source[currentPosition] == 'u')) {
- // getNextUnicodeChar();
- // } else {
- // if (withoutUnicodePtr != 0) {
- // withoutUnicodeBuffer[++withoutUnicodePtr] =
- // currentCharacter;
- // }
- // }
- while (currentCharacter != '`') {
- /** ** in PHP \r and \n are valid in string literals *** */
- // if ((currentCharacter == '\n')
- // || (currentCharacter == '\r')) {
- // // relocate if finding another quote fairly close: thus
- // unicode '/u000D' will be fully consumed
- // for (int lookAhead = 0; lookAhead < 50; lookAhead++) {
- // if (currentPosition + lookAhead == source.length)
- // break;
- // if (source[currentPosition + lookAhead] == '\n')
- // break;
- // if (source[currentPosition + lookAhead] == '\"') {
- // currentPosition += lookAhead + 1;
- // break;
- // }
- // }
- // throw new InvalidInputException(INVALID_CHAR_IN_STRING);
// }
- if (currentCharacter == '\\') {
- int escapeSize = currentPosition;
- boolean backSlashAsUnicodeInString = unicodeAsBackSlash;
- //scanEscapeCharacter make a side effect on this value and
- // we need the previous value few lines down this one
- scanDoubleQuotedEscapeCharacter();
- escapeSize = currentPosition - escapeSize;
- if (withoutUnicodePtr == 0) {
- //buffer all the entries that have been left aside....
- withoutUnicodePtr = currentPosition - escapeSize - 1
- - startPosition;
- System.arraycopy(source, startPosition,
- withoutUnicodeBuffer, 1, withoutUnicodePtr);
- withoutUnicodeBuffer[++withoutUnicodePtr] = currentCharacter;
- } else { //overwrite the / in the buffer
- withoutUnicodeBuffer[withoutUnicodePtr] = currentCharacter;
- if (backSlashAsUnicodeInString) { //there are TWO \ in
- // the stream where
- // only one is correct
- withoutUnicodePtr--;
+ while (currentCharacter != '\'') {
+ /** ** in PHP \r and \n are valid in string literals *** */
+ // if ((currentCharacter == '\n')
+ // || (currentCharacter == '\r')) {
+ // // relocate if finding another quote fairly close: thus
+ // unicode '/u000D' will be fully consumed
+ // for (int lookAhead = 0; lookAhead < 50; lookAhead++) {
+ // if (currentPosition + lookAhead == source.length)
+ // break;
+ // if (source[currentPosition + lookAhead] == '\n')
+ // break;
+ // if (source[currentPosition + lookAhead] == '\"') {
+ // currentPosition += lookAhead + 1;
+ // break;
+ // }
+ // }
+ // throw new InvalidInputException(INVALID_CHAR_IN_STRING);
+ // }
+ if (currentCharacter == '\\') {
+ int escapeSize = currentPosition;
+ boolean backSlashAsUnicodeInString = unicodeAsBackSlash;
+ //scanEscapeCharacter make a side effect on this value and
+ // we need the previous value few lines down this one
+ scanSingleQuotedEscapeCharacter();
+ escapeSize = currentPosition - escapeSize;
+ if (withoutUnicodePtr == 0) {
+ //buffer all the entries that have been left aside....
+ withoutUnicodePtr = currentPosition - escapeSize - 1
+ - startPosition;
+ System.arraycopy(source, startPosition,
+ withoutUnicodeBuffer, 1, withoutUnicodePtr);
+ withoutUnicodeBuffer[++withoutUnicodePtr] = currentCharacter;
+ } else { //overwrite the / in the buffer
+ withoutUnicodeBuffer[withoutUnicodePtr] = currentCharacter;
+ if (backSlashAsUnicodeInString) { //there are TWO \ in
+ // the stream where
+ // only one is correct
+ withoutUnicodePtr--;
+ }
}
}
+ // consume next character
+ unicodeAsBackSlash = false;
+ currentCharacter = source[currentPosition++];
+ // if (((currentCharacter = source[currentPosition++]) ==
+ // '\\')
+ // && (source[currentPosition] == 'u')) {
+ // getNextUnicodeChar();
+ // } else {
+ if (withoutUnicodePtr != 0) {
+ withoutUnicodeBuffer[++withoutUnicodePtr] = currentCharacter;
+ }
+ // }
}
- // consume next character
- unicodeAsBackSlash = false;
- currentCharacter = source[currentPosition++];
- // if (((currentCharacter = source[currentPosition++]) ==
- // '\\')
- // && (source[currentPosition] == 'u')) {
- // getNextUnicodeChar();
- // } else {
- if (withoutUnicodePtr != 0) {
- withoutUnicodeBuffer[++withoutUnicodePtr] = currentCharacter;
- }
- // }
- }
- } catch (IndexOutOfBoundsException e) {
- throw new InvalidInputException(UNTERMINATED_STRING);
- } catch (InvalidInputException e) {
- if (e.getMessage().equals(INVALID_ESCAPE)) {
- // relocate if finding another quote fairly close: thus
- // unicode '/u000D' will be fully consumed
- for (int lookAhead = 0; lookAhead < 50; lookAhead++) {
- if (currentPosition + lookAhead == source.length)
- break;
- if (source[currentPosition + lookAhead] == '\n')
- break;
- if (source[currentPosition + lookAhead] == '`') {
- currentPosition += lookAhead + 1;
- break;
+ } catch (IndexOutOfBoundsException e) {
+ throw new InvalidInputException(UNTERMINATED_STRING);
+ } catch (InvalidInputException e) {
+ if (e.getMessage().equals(INVALID_ESCAPE)) {
+ // relocate if finding another quote fairly close: thus
+ // unicode '/u000D' will be fully consumed
+ for (int lookAhead = 0; lookAhead < 50; lookAhead++) {
+ if (currentPosition + lookAhead == source.length)
+ break;
+ if (source[currentPosition + lookAhead] == '\n')
+ break;
+ if (source[currentPosition + lookAhead] == '\'') {
+ currentPosition += lookAhead + 1;
+ break;
+ }
}
}
+ throw e; // rethrow
}
- throw e; // rethrow
- }
- if (checkNonExternalizedStringLiterals) { // check for presence
- // of NLS tags
- // //$NON-NLS-?$ where
- // ? is an int.
- if (currentLine == null) {
- currentLine = new NLSLine();
- lines.add(currentLine);
- }
- currentLine.add(new StringLiteral(
- getCurrentTokenSourceString(), startPosition,
- currentPosition - 1));
- }
- return TokenNameStringInterpolated;
- case '#' :
- case '/' :
- {
- char startChar = currentCharacter;
- if (getNextChar('=')) {
- return TokenNameDIVIDE_EQUAL;
+ if (checkNonExternalizedStringLiterals) { // check for presence
+ // of NLS tags
+ // //$NON-NLS-?$ where
+ // ? is an int.
+ if (currentLine == null) {
+ currentLine = new NLSLine();
+ lines.add(currentLine);
+ }
+ currentLine.add(new StringLiteral(
+ getCurrentTokenSourceString(), startPosition,
+ currentPosition - 1));
}
- int test;
- if ((startChar == '#') || (test = getNextChar('/', '*')) == 0) {
- //line comment
- int endPositionForLineComment = 0;
- try { //get the next char
- currentCharacter = source[currentPosition++];
- // if (((currentCharacter = source[currentPosition++])
- // == '\\')
- // && (source[currentPosition] == 'u')) {
- // //-------------unicode traitement ------------
- // int c1 = 0, c2 = 0, c3 = 0, c4 = 0;
- // currentPosition++;
- // while (source[currentPosition] == 'u') {
- // currentPosition++;
- // }
- // if ((c1 =
- // Character.getNumericValue(source[currentPosition++]))
- // > 15
- // || c1 < 0
- // || (c2 =
- // Character.getNumericValue(source[currentPosition++]))
- // > 15
- // || c2 < 0
- // || (c3 =
- // Character.getNumericValue(source[currentPosition++]))
- // > 15
- // || c3 < 0
- // || (c4 =
- // Character.getNumericValue(source[currentPosition++]))
- // > 15
- // || c4 < 0) {
- // throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
- // } else {
- // currentCharacter =
- // (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4);
- // }
- // }
- //handle the \\u case manually into comment
- // if (currentCharacter == '\\') {
- // if (source[currentPosition] == '\\')
- // currentPosition++;
- // } //jump over the \\
- boolean isUnicode = false;
- while (currentCharacter != '\r' && currentCharacter != '\n') {
- if (currentCharacter == '?') {
- if (getNextChar('>')) {
- startPosition = currentPosition - 2;
- phpMode = false;
- return TokenNameINLINE_HTML;
- }
- }
- //get the next char
- isUnicode = false;
+ return TokenNameStringConstant;
+ case '"' :
+ return TokenNameEncapsedString2;
+ case '`' :
+ return TokenNameEncapsedString0;
+ case '#' :
+ case '/' :
+ {
+ char startChar = currentCharacter;
+ if (getNextChar('=')) {
+ return TokenNameDIVIDE_EQUAL;
+ }
+ int test;
+ if ((startChar == '#') || (test = getNextChar('/', '*')) == 0) {
+ //line comment
+ int endPositionForLineComment = 0;
+ try { //get the next char
currentCharacter = source[currentPosition++];
- // if (((currentCharacter = source[currentPosition++])
- // == '\\')
- // && (source[currentPosition] == 'u')) {
- // isUnicode = true;
- // //-------------unicode traitement ------------
- // int c1 = 0, c2 = 0, c3 = 0, c4 = 0;
+ // if (((currentCharacter = source[currentPosition++])
+ // == '\\')
+ // && (source[currentPosition] == 'u')) {
+ // //-------------unicode traitement ------------
+ // int c1 = 0, c2 = 0, c3 = 0, c4 = 0;
+ // currentPosition++;
+ // while (source[currentPosition] == 'u') {
// currentPosition++;
- // while (source[currentPosition] == 'u') {
- // currentPosition++;
- // }
- // if ((c1 =
+ // }
+ // if ((c1 =
+ // Character.getNumericValue(source[currentPosition++]))
+ // > 15
+ // || c1 < 0
+ // || (c2 =
+ // Character.getNumericValue(source[currentPosition++]))
+ // > 15
+ // || c2 < 0
+ // || (c3 =
+ // Character.getNumericValue(source[currentPosition++]))
+ // > 15
+ // || c3 < 0
+ // || (c4 =
// Character.getNumericValue(source[currentPosition++]))
// > 15
- // || c1 < 0
- // || (c2 =
- // Character.getNumericValue(
- // source[currentPosition++]))
- // > 15
- // || c2 < 0
- // || (c3 =
- // Character.getNumericValue(
- // source[currentPosition++]))
- // > 15
- // || c3 < 0
- // || (c4 =
- // Character.getNumericValue(
- // source[currentPosition++]))
- // > 15
- // || c4 < 0) {
- // throw new
+ // || c4 < 0) {
+ // throw new
// InvalidInputException(INVALID_UNICODE_ESCAPE);
- // } else {
- // currentCharacter =
- // (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4);
- // }
+ // } else {
+ // currentCharacter =
+ // (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4);
// }
+ // }
//handle the \\u case manually into comment
- // if (currentCharacter == '\\') {
- // if (source[currentPosition] == '\\')
- // currentPosition++;
- // } //jump over the \\
+ // if (currentCharacter == '\\') {
+ // if (source[currentPosition] == '\\')
+ // currentPosition++;
+ // } //jump over the \\
+ boolean isUnicode = false;
+ while (currentCharacter != '\r'
+ && currentCharacter != '\n') {
+ if (currentCharacter == '?') {
+ if (getNextChar('>')) {
+ startPosition = currentPosition - 2;
+ phpMode = false;
+ return TokenNameINLINE_HTML;
+ }
+ }
+ //get the next char
+ isUnicode = false;
+ currentCharacter = source[currentPosition++];
+ // if (((currentCharacter = source[currentPosition++])
+ // == '\\')
+ // && (source[currentPosition] == 'u')) {
+ // isUnicode = true;
+ // //-------------unicode traitement ------------
+ // int c1 = 0, c2 = 0, c3 = 0, c4 = 0;
+ // currentPosition++;
+ // while (source[currentPosition] == 'u') {
+ // currentPosition++;
+ // }
+ // if ((c1 =
+ // Character.getNumericValue(source[currentPosition++]))
+ // > 15
+ // || c1 < 0
+ // || (c2 =
+ // Character.getNumericValue(
+ // source[currentPosition++]))
+ // > 15
+ // || c2 < 0
+ // || (c3 =
+ // Character.getNumericValue(
+ // source[currentPosition++]))
+ // > 15
+ // || c3 < 0
+ // || (c4 =
+ // Character.getNumericValue(
+ // source[currentPosition++]))
+ // > 15
+ // || c4 < 0) {
+ // throw new
+ // InvalidInputException(INVALID_UNICODE_ESCAPE);
+ // } else {
+ // currentCharacter =
+ // (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4);
+ // }
+ // }
+ //handle the \\u case manually into comment
+ // if (currentCharacter == '\\') {
+ // if (source[currentPosition] == '\\')
+ // currentPosition++;
+ // } //jump over the \\
+ }
+ if (isUnicode) {
+ endPositionForLineComment = currentPosition - 6;
+ } else {
+ endPositionForLineComment = currentPosition - 1;
+ }
+ recordComment(false);
+ if ((currentCharacter == '\r')
+ || (currentCharacter == '\n')) {
+ checkNonExternalizeString();
+ if (recordLineSeparator) {
+ if (isUnicode) {
+ pushUnicodeLineSeparator();
+ } else {
+ pushLineSeparator();
+ }
+ } else {
+ currentLine = null;
+ }
+ }
+ if (tokenizeComments) {
+ if (!isUnicode) {
+ currentPosition = endPositionForLineComment;
+ // reset one character behind
+ }
+ return TokenNameCOMMENT_LINE;
+ }
+ } catch (IndexOutOfBoundsException e) { //an eof will them
+ // be generated
+ if (tokenizeComments) {
+ currentPosition--;
+ // reset one character behind
+ return TokenNameCOMMENT_LINE;
+ }
}
- if (isUnicode) {
- endPositionForLineComment = currentPosition - 6;
- } else {
- endPositionForLineComment = currentPosition - 1;
+ break;
+ }
+ if (test > 0) {
+ //traditional and annotation comment
+ boolean isJavadoc = false, star = false;
+ // consume next character
+ unicodeAsBackSlash = false;
+ currentCharacter = source[currentPosition++];
+ // if (((currentCharacter = source[currentPosition++]) ==
+ // '\\')
+ // && (source[currentPosition] == 'u')) {
+ // getNextUnicodeChar();
+ // } else {
+ // if (withoutUnicodePtr != 0) {
+ // withoutUnicodeBuffer[++withoutUnicodePtr] =
+ // currentCharacter;
+ // }
+ // }
+ if (currentCharacter == '*') {
+ isJavadoc = true;
+ star = true;
}
- recordComment(false);
if ((currentCharacter == '\r')
|| (currentCharacter == '\n')) {
checkNonExternalizeString();
if (recordLineSeparator) {
- if (isUnicode) {
- pushUnicodeLineSeparator();
- } else {
- pushLineSeparator();
- }
+ pushLineSeparator();
} else {
currentLine = null;
}
}
- if (tokenizeComments) {
- if (!isUnicode) {
- currentPosition = endPositionForLineComment;
- // reset one character behind
+ try { //get the next char
+ currentCharacter = source[currentPosition++];
+ // if (((currentCharacter = source[currentPosition++])
+ // == '\\')
+ // && (source[currentPosition] == 'u')) {
+ // //-------------unicode traitement ------------
+ // getNextUnicodeChar();
+ // }
+ //handle the \\u case manually into comment
+ // if (currentCharacter == '\\') {
+ // if (source[currentPosition] == '\\')
+ // currentPosition++;
+ // //jump over the \\
+ // }
+ // empty comment is not a javadoc /**/
+ if (currentCharacter == '/') {
+ isJavadoc = false;
}
- return TokenNameCOMMENT_LINE;
- }
- } catch (IndexOutOfBoundsException e) { //an eof will them
- // be generated
- if (tokenizeComments) {
- currentPosition--;
- // reset one character behind
- return TokenNameCOMMENT_LINE;
+ //loop until end of comment */
+ while ((currentCharacter != '/') || (!star)) {
+ if ((currentCharacter == '\r')
+ || (currentCharacter == '\n')) {
+ checkNonExternalizeString();
+ if (recordLineSeparator) {
+ pushLineSeparator();
+ } else {
+ currentLine = null;
+ }
+ }
+ star = currentCharacter == '*';
+ //get next char
+ currentCharacter = source[currentPosition++];
+ // if (((currentCharacter = source[currentPosition++])
+ // == '\\')
+ // && (source[currentPosition] == 'u')) {
+ // //-------------unicode traitement ------------
+ // getNextUnicodeChar();
+ // }
+ //handle the \\u case manually into comment
+ // if (currentCharacter == '\\') {
+ // if (source[currentPosition] == '\\')
+ // currentPosition++;
+ // } //jump over the \\
+ }
+ recordComment(isJavadoc);
+ if (tokenizeComments) {
+ if (isJavadoc)
+ return TokenNameCOMMENT_PHPDOC;
+ return TokenNameCOMMENT_BLOCK;
+ }
+ } catch (IndexOutOfBoundsException e) {
+ throw new InvalidInputException(UNTERMINATED_COMMENT);
}
+ break;
}
- break;
+ return TokenNameDIVIDE;
}
- if (test > 0) {
- //traditional and annotation comment
- boolean isJavadoc = false, star = false;
- // consume next character
- unicodeAsBackSlash = false;
- currentCharacter = source[currentPosition++];
- // if (((currentCharacter = source[currentPosition++]) ==
- // '\\')
- // && (source[currentPosition] == 'u')) {
- // getNextUnicodeChar();
- // } else {
- // if (withoutUnicodePtr != 0) {
- // withoutUnicodeBuffer[++withoutUnicodePtr] =
- // currentCharacter;
- // }
- // }
- if (currentCharacter == '*') {
- isJavadoc = true;
- star = true;
- }
- if ((currentCharacter == '\r') || (currentCharacter == '\n')) {
- checkNonExternalizeString();
- if (recordLineSeparator) {
- pushLineSeparator();
- } else {
- currentLine = null;
- }
- }
- try { //get the next char
+ case '\u001a' :
+ if (atEnd())
+ return TokenNameEOF;
+ //the atEnd may not be <currentPosition == source.length> if
+ // source is only some part of a real (external) stream
+ throw new InvalidInputException("Ctrl-Z"); //$NON-NLS-1$
+ default :
+ if (currentCharacter == '$') {
+ int oldPosition = currentPosition;
+ try {
currentCharacter = source[currentPosition++];
- // if (((currentCharacter = source[currentPosition++])
- // == '\\')
- // && (source[currentPosition] == 'u')) {
- // //-------------unicode traitement ------------
- // getNextUnicodeChar();
- // }
- //handle the \\u case manually into comment
- // if (currentCharacter == '\\') {
- // if (source[currentPosition] == '\\')
- // currentPosition++;
- // //jump over the \\
- // }
- // empty comment is not a javadoc /**/
- if (currentCharacter == '/') {
- isJavadoc = false;
- }
- //loop until end of comment */
- while ((currentCharacter != '/') || (!star)) {
- if ((currentCharacter == '\r')
- || (currentCharacter == '\n')) {
- checkNonExternalizeString();
- if (recordLineSeparator) {
- pushLineSeparator();
- } else {
- currentLine = null;
- }
- }
- star = currentCharacter == '*';
- //get next char
- currentCharacter = source[currentPosition++];
- // if (((currentCharacter = source[currentPosition++])
- // == '\\')
- // && (source[currentPosition] == 'u')) {
- // //-------------unicode traitement ------------
- // getNextUnicodeChar();
- // }
- //handle the \\u case manually into comment
- // if (currentCharacter == '\\') {
- // if (source[currentPosition] == '\\')
- // currentPosition++;
- // } //jump over the \\
- }
- recordComment(isJavadoc);
- if (tokenizeComments) {
- if (isJavadoc)
- return TokenNameCOMMENT_PHPDOC;
- return TokenNameCOMMENT_BLOCK;
+ if (isPHPIdentifierStart(currentCharacter)) {
+ return scanIdentifierOrKeyword(true);
+ } else {
+ currentPosition = oldPosition;
+ return TokenNameDOLLAR;
}
} catch (IndexOutOfBoundsException e) {
- throw new InvalidInputException(UNTERMINATED_COMMENT);
- }
- break;
- }
- return TokenNameDIVIDE;
- }
- case '\u001a' :
- if (atEnd())
- return TokenNameEOF;
- //the atEnd may not be <currentPosition == source.length> if
- // source is only some part of a real (external) stream
- throw new InvalidInputException("Ctrl-Z"); //$NON-NLS-1$
- default :
- if (currentCharacter == '$') {
- int oldPosition = currentPosition;
- try {
- currentCharacter = source[currentPosition++];
- if (isPHPIdentifierStart(currentCharacter)) {
- return scanIdentifierOrKeyword(true);
- } else {
currentPosition = oldPosition;
return TokenNameDOLLAR;
}
- } catch (IndexOutOfBoundsException e) {
- currentPosition = oldPosition;
- return TokenNameDOLLAR;
}
- }
- if (isPHPIdentifierStart(currentCharacter))
- return scanIdentifierOrKeyword(false);
- if (Character.isDigit(currentCharacter))
- return scanNumber(false);
- return TokenNameERROR;
- }
+ if (isPHPIdentifierStart(currentCharacter))
+ return scanIdentifierOrKeyword(false);
+ if (Character.isDigit(currentCharacter))
+ return scanNumber(false);
+ return TokenNameERROR;
+ }
+
}
} //-----------------end switch while try--------------------
catch (IndexOutOfBoundsException e) {
*/
private int getInlinedHTML(int start) throws InvalidInputException {
// int htmlPosition = start;
- if (currentPosition>source.length) {
- currentPosition = source.length;
- return TokenNameEOF;
+ if (currentPosition > source.length) {
+ currentPosition = source.length;
+ return TokenNameEOF;
}
startPosition = start;
try {
initialPosition = currentPosition = 0;
containsAssertKeyword = false;
withoutUnicodeBuffer = new char[this.source.length];
+ encapsedStringStack = new Stack();
}
public String toString() {
if (startPosition == source.length)
case TokenNameDoubleLiteral :
return "Double(" + new String(getCurrentTokenSource()) + ")"; //$NON-NLS-1$ //$NON-NLS-2$
case TokenNameStringLiteral :
- return "String(" + new String(getCurrentTokenSource()) + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ return "StringLiteral(" + new String(getCurrentTokenSource()) + ")"; //$NON-NLS-1$ //$NON-NLS-2$
case TokenNameStringConstant :
return "StringConstant(" + new String(getCurrentTokenSource()) + ")"; //$NON-NLS-1$ //$NON-NLS-2$
case TokenNameStringInterpolated :
return "StringInterpolated(" + new String(getCurrentTokenSource())
+ ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ case TokenNameEncapsedString0 :
+ return "`"; //$NON-NLS-1$
+ case TokenNameEncapsedString1 :
+ return "\'"; //$NON-NLS-1$
+ case TokenNameEncapsedString2 :
+ return "\""; //$NON-NLS-1$
+ case TokenNameSTRING :
+ return "STRING(" + new String(getCurrentTokenSource()) + ")"; //$NON-NLS-1$ //$NON-NLS-2$
case TokenNameHEREDOC :
return "HEREDOC(" + new String(getCurrentTokenSource()) + ")"; //$NON-NLS-1$
case TokenNamePLUS_PLUS :
return "@";
case TokenNameDOLLAR :
return "$";
- // case TokenNameDOLLAR_LBRACE :
- // return "${";
+ case TokenNameDOLLAR_LBRACE :
+ return "${";
case TokenNameEOF :
return "EOF"; //$NON-NLS-1$
case TokenNameWHITESPACE :
return "COMMENT_BLOCK(" + new String(getCurrentTokenSource()) + ")"; //$NON-NLS-1$
case TokenNameCOMMENT_PHPDOC :
return "COMMENT_PHPDOC(" + new String(getCurrentTokenSource()) + ")"; //$NON-NLS-1$
- // case TokenNameHTML :
- // return "HTML(" + new String(getCurrentTokenSource()) + ")";
- // //$NON-NLS-1$
+ // case TokenNameHTML :
+ // return "HTML(" + new String(getCurrentTokenSource()) + ")";
+ // //$NON-NLS-1$
case TokenNameFILE :
return "__FILE__"; //$NON-NLS-1$
case TokenNameLINE :
this.tokenizeWhiteSpace = tokenizeWhiteSpace;
this.checkNonExternalizedStringLiterals = checkNonExternalizedStringLiterals;
this.assertMode = assertMode;
+ this.encapsedStringStack = null;
}
private void checkNonExternalizeString() throws InvalidInputException {
if (currentLine == null)
package net.sourceforge.phpdt.internal.compiler.parser;
+import java.util.Stack;
+
import net.sourceforge.phpdt.core.IJavaModelMarker;
import net.sourceforge.phpdt.core.compiler.IProblem;
import net.sourceforge.phpdt.internal.compiler.CompilationResult;
// A P I
public void parse(MethodDeclaration md, CompilationUnitDeclaration unit) {
- //only parse the method body of md
- //fill out method statements
-
- //convert bugs into parse error
-
- if (md.isAbstract())
- return;
- // if (md.isNative())
- // return;
- // if ((md.modifiers & AccSemicolonBody) != 0)
- // return;
-
- initialize(false);
- goForMethodBody();
- nestedMethod[nestedType]++;
-
- referenceContext = md;
- compilationUnit = unit;
-
- scanner.resetTo(md.sourceEnd + 1, md.declarationSourceEnd);
- // reset the scanner to parser from { down to }
- try {
- parse();
- } catch (AbortCompilation ex) {
- lastAct = ERROR_ACTION;
- } finally {
- nestedMethod[nestedType]--;
- }
-
- // if (lastAct == ERROR_ACTION) {
- // return;
- // }
- //
- // //refill statements
- // md.explicitDeclarations = realBlockStack[realBlockPtr--];
- // int length;
- // if ((length = astLengthStack[astLengthPtr--]) != 0)
- // System.arraycopy(
- // astStack,
- // (astPtr -= length) + 1,
- // md.statements = new Statement[length],
- // 0,
- // length);
+// TODO jsurfer - make the parse process work on methods ?
+ return;
+
+// //only parse the method body of md
+// //fill out method statements
+//
+// //convert bugs into parse error
+//
+// if (md.isAbstract())
+// return;
+// // if (md.isNative())
+// // return;
+// // if ((md.modifiers & AccSemicolonBody) != 0)
+// // return;
+//
+// initialize(false);
+// goForMethodBody();
+// nestedMethod[nestedType]++;
+//
+// referenceContext = md;
+// compilationUnit = unit;
+//
+// scanner.resetTo(md.sourceEnd + 1, md.declarationSourceEnd);
+//
+// // reset the scanner to parser from { down to }
+// try {
+// parse();
+// } catch (AbortCompilation ex) {
+// lastAct = ERROR_ACTION;
+// } finally {
+// nestedMethod[nestedType]--;
+// }
+//
+// // if (lastAct == ERROR_ACTION) {
+// // return;
+// // }
+// //
+// // //refill statements
+// // md.explicitDeclarations = realBlockStack[realBlockPtr--];
+// // int length;
+// // if ((length = astLengthStack[astLengthPtr--]) != 0)
+// // System.arraycopy(
+// // astStack,
+// // (astPtr -= length) + 1,
+// // md.statements = new Statement[length],
+// // 0,
+// // length);
}
// A P I
package net.sourceforge.phpdt.internal.compiler.problem;
import net.sourceforge.phpdt.core.compiler.IProblem;
import net.sourceforge.phpdt.internal.compiler.util.Util;
-import org.eclipse.ui.texteditor.ITextEditor;
+
public class DefaultProblem implements ProblemSeverities, IProblem {
private char[] fileName;
private int id;
DeltaProcessor deltaProcessor = JavaModelManager.getJavaModelManager().deltaProcessor;
if (deltaProcessor.roots == null) {
// TODO khartlage temp-del
- deltaProcessor.initializeRoots();
+ deltaProcessor.initializeRoots();
}
executeOperation();
} else {
}
}
} finally {
-// TODO khartlage temp-del
-// try {
-// // update JavaModel using deltas that were recorded during this operation
+
+ try {
+// TODO khartlage temp-del
+ // update JavaModel using deltas that were recorded during this operation
// for (int i = previousDeltaCount, size = manager.javaModelDeltas.size(); i < size; i++) {
// manager.updateJavaModel((IJavaElementDelta)manager.javaModelDeltas.get(i));
// }
-//
-// // fire only iff:
-// // - the operation is a top level operation
-// // - the operation did produce some delta(s)
-// // - but the operation has not modified any resource
-// if (this.isTopLevelOperation()) {
-// if ((manager.javaModelDeltas.size() > previousDeltaCount || !manager.reconcileDeltas.isEmpty())
-// && !this.hasModifiedResource()) {
-// manager.fire(null, JavaModelManager.DEFAULT_CHANGE_EVENT);
-// } // else deltas are fired while processing the resource delta
-// }
-// } finally {
-// popOperation();
-// }
+
+ // fire only iff:
+ // - the operation is a top level operation
+ // - the operation did produce some delta(s)
+ // - but the operation has not modified any resource
+ if (this.isTopLevelOperation()) {
+ if ((manager.javaModelDeltas.size() > previousDeltaCount || !manager.reconcileDeltas.isEmpty())
+ && !this.hasModifiedResource()) {
+ manager.fire(null, JavaModelManager.DEFAULT_CHANGE_EVENT);
+ } // else deltas are fired while processing the resource delta
+ }
+ } finally {
+ popOperation();
+ }
}
}
protected void runPostActions() throws JavaModelException {
* @exception JavaModelException if setting the source
* of the original compilation unit fails
*/
+// protected void executeOperation() throws JavaModelException {
+// if (fMonitor != null){
+// if (fMonitor.isCanceled()) return;
+// fMonitor.beginTask(Util.bind("element.reconciling"), 10); //$NON-NLS-1$
+// }
+//
+// WorkingCopy workingCopy = getWorkingCopy();
+// boolean wasConsistent = workingCopy.isConsistent();
+// JavaElementDeltaBuilder deltaBuilder = null;
+//
+// try {
+// // create the delta builder (this remembers the current content of the cu)
+// if (!wasConsistent){
+// deltaBuilder = new JavaElementDeltaBuilder(workingCopy);
+//
+// // update the element infos with the content of the working copy
+// workingCopy.makeConsistent(fMonitor);
+// deltaBuilder.buildDeltas();
+//
+// }
+//
+// if (fMonitor != null) fMonitor.worked(2);
+//
+// // force problem detection? - if structure was consistent
+// if (forceProblemDetection && wasConsistent){
+// if (fMonitor != null && fMonitor.isCanceled()) return;
+//
+// IProblemRequestor problemRequestor = workingCopy.problemRequestor;
+// if (problemRequestor != null && problemRequestor.isActive()){
+// problemRequestor.beginReporting();
+// CompilationUnitProblemFinder.process(workingCopy, problemRequestor, fMonitor);
+// problemRequestor.endReporting();
+// }
+// }
+//
+// // register the deltas
+// if (deltaBuilder != null){
+// if ((deltaBuilder.delta != null) && (deltaBuilder.delta.getAffectedChildren().length > 0)) {
+// addReconcileDelta(workingCopy, deltaBuilder.delta);
+// }
+// }
+// } finally {
+// if (fMonitor != null) fMonitor.done();
+// }
+// }
protected void executeOperation() throws JavaModelException {
+ // TODO jsurfer optimize for PHP
if (fMonitor != null){
if (fMonitor.isCanceled()) return;
fMonitor.beginTask(Util.bind("element.reconciling"), 10); //$NON-NLS-1$
}
WorkingCopy workingCopy = getWorkingCopy();
- boolean wasConsistent = workingCopy.isConsistent();
- JavaElementDeltaBuilder deltaBuilder = null;
+// boolean wasConsistent = workingCopy.isConsistent();
+// JavaElementDeltaBuilder deltaBuilder = null;
try {
// create the delta builder (this remembers the current content of the cu)
- if (!wasConsistent){
- deltaBuilder = new JavaElementDeltaBuilder(workingCopy);
-
- // update the element infos with the content of the working copy
- workingCopy.makeConsistent(fMonitor);
- deltaBuilder.buildDeltas();
-
- }
+// if (!wasConsistent){
+// deltaBuilder = new JavaElementDeltaBuilder(workingCopy);
+//
+// // update the element infos with the content of the working copy
+// workingCopy.makeConsistent(fMonitor);
+// deltaBuilder.buildDeltas();
+//
+// }
if (fMonitor != null) fMonitor.worked(2);
// force problem detection? - if structure was consistent
- if (forceProblemDetection && wasConsistent){
+ if (forceProblemDetection){
if (fMonitor != null && fMonitor.isCanceled()) return;
IProblemRequestor problemRequestor = workingCopy.problemRequestor;
}
// register the deltas
- if (deltaBuilder != null){
- if ((deltaBuilder.delta != null) && (deltaBuilder.delta.getAffectedChildren().length > 0)) {
- addReconcileDelta(workingCopy, deltaBuilder.delta);
- }
- }
+// if (deltaBuilder != null){
+// if ((deltaBuilder.delta != null) && (deltaBuilder.delta.getAffectedChildren().length > 0)) {
+// addReconcileDelta(workingCopy, deltaBuilder.delta);
+// }
+// }
} finally {
if (fMonitor != null) fMonitor.done();
}
NewJavaProjectPreferencePage.error.decode=Error while decoding JRE entry
PHPEditorPreferencePage.updatesOnNextChangeIinEditor.label=Note: Updates on next change in the editor
-PHPEditorPreferencePage.problemIndicationTab.title=Problem Indi&cation
+PHPEditorPreferencePage.annotationsTab.title= Annotation&s
PHPEditorPreferencePage.showQuickFixables=&Indicate problems solvable with Quick Fix in vertical ruler
PHPEditorPreferencePage.description=PHP Editor settings:
PHPEditorPreferencePage.font=Text Font:
-package net.sourceforge.phpdt.internal.ui.dialog;
+package net.sourceforge.phpdt.internal.ui.dialogs;
import net.sourceforge.phpdt.internal.ui.util.FilteredList;
-package net.sourceforge.phpdt.internal.ui.dialog;
+package net.sourceforge.phpdt.internal.ui.dialogs;
import java.util.ArrayList;
import java.util.Arrays;
-package net.sourceforge.phpdt.internal.ui.dialog;
+package net.sourceforge.phpdt.internal.ui.dialogs;
import java.util.Arrays;
import java.util.List;
-package net.sourceforge.phpdt.internal.ui.dialog;
+package net.sourceforge.phpdt.internal.ui.dialogs;
import org.eclipse.core.runtime.IStatus;
-package net.sourceforge.phpdt.internal.ui.dialog;
+package net.sourceforge.phpdt.internal.ui.dialogs;
import net.sourceforge.phpdt.internal.ui.PHPUiImages;
-package net.sourceforge.phpdt.internal.ui.dialog;
+package net.sourceforge.phpdt.internal.ui.dialogs;
import java.util.Arrays;
-package net.sourceforge.phpdt.internal.ui.dialog;
+package net.sourceforge.phpdt.internal.ui.dialogs;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.Dialog;
-package net.sourceforge.phpdt.internal.ui.dialog;
+package net.sourceforge.phpdt.internal.ui.dialogs;
import net.sourceforge.phpeclipse.PHPeclipsePlugin;
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
-package net.sourceforge.phpdt.internal.ui.dialog;
+package net.sourceforge.phpdt.internal.ui.dialogs;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.DialogPage;
import net.sourceforge.phpdt.core.JavaCore;
import net.sourceforge.phpdt.core.ToolFactory;
import net.sourceforge.phpdt.internal.ui.PHPUIMessages;
-import net.sourceforge.phpdt.internal.ui.dialog.StatusInfo;
-import net.sourceforge.phpdt.internal.ui.dialog.StatusUtil;
+import net.sourceforge.phpdt.internal.ui.dialogs.StatusInfo;
+import net.sourceforge.phpdt.internal.ui.dialogs.StatusUtil;
import net.sourceforge.phpdt.internal.ui.util.TabFolderLayout;
import net.sourceforge.phpeclipse.PHPeclipsePlugin;
import net.sourceforge.phpdt.internal.corext.template.Template;
import net.sourceforge.phpdt.internal.corext.template.TemplateMessages;
import net.sourceforge.phpdt.internal.corext.template.TemplateTranslator;
-import net.sourceforge.phpdt.internal.ui.dialog.StatusDialog;
-import net.sourceforge.phpdt.internal.ui.dialog.StatusInfo;
+import net.sourceforge.phpdt.internal.ui.dialogs.StatusDialog;
+import net.sourceforge.phpdt.internal.ui.dialogs.StatusInfo;
import net.sourceforge.phpdt.internal.ui.text.template.TemplateVariableProcessor;
import net.sourceforge.phpdt.internal.ui.util.SWTUtil;
import net.sourceforge.phpdt.ui.text.JavaTextTools;
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package net.sourceforge.phpdt.internal.ui.preferences;
+
+import java.util.HashMap;
+import java.util.StringTokenizer;
+
+import net.sourceforge.phpdt.internal.ui.dialogs.StatusInfo;
+import net.sourceforge.phpdt.internal.ui.dialogs.StatusUtil;
+import net.sourceforge.phpdt.internal.ui.text.java.hover.JavaEditorTextHoverDescriptor;
+import net.sourceforge.phpdt.internal.ui.util.PixelConverter;
+import net.sourceforge.phpdt.ui.PreferenceConstants;
+import net.sourceforge.phpeclipse.PHPeclipsePlugin;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.text.Assert;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.List;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * Configures Java Editor hover preferences.
+ *
+ * @since 2.1
+ */
+class JavaEditorHoverConfigurationBlock {
+
+ private static final String DELIMITER= PreferencesMessages.getString("JavaEditorHoverConfigurationBlock.delimiter"); //$NON-NLS-1$
+
+ // Data structure to hold the values which are edited by the user
+ private static class HoverConfig {
+
+ private String fModifierString;
+ private boolean fIsEnabled;
+ private int fStateMask;
+
+ private HoverConfig(String modifier, int stateMask, boolean enabled) {
+ fModifierString= modifier;
+ fIsEnabled= enabled;
+ fStateMask= stateMask;
+ }
+ }
+
+ private IPreferenceStore fStore;
+ private HoverConfig[] fHoverConfigs;
+ private Text fModifierEditor;
+ private Button fEnableField;
+ private List fHoverList;
+ private Text fDescription;
+// private Button fShowHoverAffordanceCheckbox;
+
+ private JavaEditorPreferencePage fMainPreferencePage;
+
+ private StatusInfo fStatus;
+
+ public JavaEditorHoverConfigurationBlock(JavaEditorPreferencePage mainPreferencePage, IPreferenceStore store) {
+ Assert.isNotNull(mainPreferencePage);
+ Assert.isNotNull(store);
+ fMainPreferencePage= mainPreferencePage;
+ fStore= store;
+ }
+
+ /**
+ * Creates page for hover preferences.
+ */
+ public Control createControl(Composite parent) {
+
+ PixelConverter pixelConverter= new PixelConverter(parent);
+
+ Composite hoverComposite= new Composite(parent, SWT.NULL);
+ GridLayout layout= new GridLayout();
+ layout.numColumns= 2;
+ hoverComposite.setLayout(layout);
+ GridData gd= new GridData(GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
+ hoverComposite.setLayoutData(gd);
+
+ Label label= new Label(hoverComposite, SWT.NONE);
+ label.setText(PreferencesMessages.getString("JavaEditorHoverConfigurationBlock.hoverPreferences")); //$NON-NLS-1$
+ gd= new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalAlignment= GridData.BEGINNING;
+ gd.horizontalSpan= 2;
+ label.setLayoutData(gd);
+ gd= new GridData(GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
+
+ // Hover list
+ fHoverList= new List(hoverComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER);
+ gd= new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
+ int listHeight= 10 * fHoverList.getItemHeight();
+ gd.heightHint= listHeight;
+ fHoverList.setLayoutData(gd);
+ fHoverList.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ handleHoverListSelection();
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+
+
+ Composite stylesComposite= new Composite(hoverComposite, SWT.NONE);
+ layout= new GridLayout();
+ layout.marginHeight= 0;
+ layout.marginWidth= 0;
+ layout.numColumns= 2;
+ stylesComposite.setLayout(layout);
+ gd= new GridData(GridData.FILL_HORIZONTAL);
+ gd.heightHint= listHeight + (2 * fHoverList.getBorderWidth());
+ stylesComposite.setLayoutData(gd);
+
+ // Enabled checkbox
+ fEnableField= new Button(stylesComposite, SWT.CHECK);
+ fEnableField.setText(PreferencesMessages.getString("JavaEditorHoverConfigurationBlock.enabled")); //$NON-NLS-1$
+ gd= new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalAlignment= GridData.BEGINNING;
+ gd.horizontalSpan= 2;
+ fEnableField.setLayoutData(gd);
+ fEnableField.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ int i= fHoverList.getSelectionIndex();
+ boolean state= fEnableField.getSelection();
+ fModifierEditor.setEnabled(state);
+ fHoverConfigs[i].fIsEnabled= state;
+ handleModifierModified();
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+
+ // Text field for modifier string
+ label= new Label(stylesComposite, SWT.LEFT);
+ label.setText(PreferencesMessages.getString("JavaEditorHoverConfigurationBlock.keyModifier")); //$NON-NLS-1$
+ fModifierEditor= new Text(stylesComposite, SWT.BORDER);
+ gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ fModifierEditor.setLayoutData(gd);
+
+ fModifierEditor.addKeyListener(new KeyListener() {
+ private boolean isModifierCandidate;
+ public void keyPressed(KeyEvent e) {
+ isModifierCandidate= e.keyCode > 0 && e.character == 0 && e.stateMask == 0;
+ }
+
+ public void keyReleased(KeyEvent e) {
+ if (isModifierCandidate && e.stateMask > 0 && e.stateMask == e.stateMask && e.character == 0) {// && e.time -time < 1000) {
+ String text= fModifierEditor.getText();
+ Point selection= fModifierEditor.getSelection();
+ int i= selection.x - 1;
+ while (i > -1 && Character.isWhitespace(text.charAt(i))) {
+ i--;
+ }
+ boolean needsPrefixDelimiter= i > -1 && !String.valueOf(text.charAt(i)).equals(DELIMITER);
+
+ i= selection.y;
+ while (i < text.length() && Character.isWhitespace(text.charAt(i))) {
+ i++;
+ }
+ boolean needsPostfixDelimiter= i < text.length() && !String.valueOf(text.charAt(i)).equals(DELIMITER);
+
+ String insertString;
+
+ if (needsPrefixDelimiter && needsPostfixDelimiter)
+ insertString= PreferencesMessages.getFormattedString("JavaEditorHoverConfigurationBlock.insertDelimiterAndModifierAndDelimiter", new String[] {Action.findModifierString(e.stateMask)}); //$NON-NLS-1$
+ else if (needsPrefixDelimiter)
+ insertString= PreferencesMessages.getFormattedString("JavaEditorHoverConfigurationBlock.insertDelimiterAndModifier", new String[] {Action.findModifierString(e.stateMask)}); //$NON-NLS-1$
+ else if (needsPostfixDelimiter)
+ insertString= PreferencesMessages.getFormattedString("JavaEditorHoverConfigurationBlock.insertModifierAndDelimiter", new String[] {Action.findModifierString(e.stateMask)}); //$NON-NLS-1$
+ else
+ insertString= Action.findModifierString(e.stateMask);
+
+ if (insertString != null)
+ fModifierEditor.insert(insertString);
+ }
+ }
+ });
+
+ fModifierEditor.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ handleModifierModified();
+ }
+ });
+
+ // Description
+ Label descriptionLabel= new Label(stylesComposite, SWT.LEFT);
+ descriptionLabel.setText(PreferencesMessages.getString("JavaEditorHoverConfigurationBlock.description")); //$NON-NLS-1$
+ gd= new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
+ gd.horizontalSpan= 2;
+ descriptionLabel.setLayoutData(gd);
+ fDescription= new Text(stylesComposite, SWT.LEFT | SWT.WRAP | SWT.MULTI | SWT.READ_ONLY | SWT.BORDER);
+ gd= new GridData(GridData.FILL_BOTH);
+ gd.horizontalSpan= 2;
+ fDescription.setLayoutData(gd);
+
+ // Vertical filler
+ Label filler= new Label(hoverComposite, SWT.LEFT);
+ gd= new GridData(GridData.BEGINNING | GridData.VERTICAL_ALIGN_FILL);
+ gd.heightHint= pixelConverter.convertHeightInCharsToPixels(1) / 3;
+ filler.setLayoutData(gd);
+
+ // Affordance checkbox
+// fShowHoverAffordanceCheckbox= new Button(hoverComposite, SWT.CHECK);
+// fShowHoverAffordanceCheckbox.setText(PreferencesMessages.getString("JavaEditorHoverConfigurationBlock.showAffordance")); //$NON-NLS-1$
+// gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
+// gd.horizontalIndent= 0;
+// gd.horizontalSpan= 2;
+// fShowHoverAffordanceCheckbox.setLayoutData(gd);
+
+ initialize();
+
+ Dialog.applyDialogFont(hoverComposite);
+ return hoverComposite;
+ }
+
+ private JavaEditorTextHoverDescriptor[] getContributedHovers() {
+ return PHPeclipsePlugin.getDefault().getJavaEditorTextHoverDescriptors();
+ }
+
+ void initialize() {
+ JavaEditorTextHoverDescriptor[] hoverDescs= getContributedHovers();
+ fHoverConfigs= new HoverConfig[hoverDescs.length];
+ for (int i= 0; i < hoverDescs.length; i++) {
+ fHoverConfigs[i]= new HoverConfig(hoverDescs[i].getModifierString(), hoverDescs[i].getStateMask(), hoverDescs[i].isEnabled());
+ fHoverList.add(hoverDescs[i].getLabel());
+ }
+ initializeFields();
+ }
+
+ void initializeFields() {
+ fHoverList.getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ if (fHoverList != null && !fHoverList.isDisposed()) {
+ fHoverList.select(0);
+ handleHoverListSelection();
+ }
+ }
+ });
+// fShowHoverAffordanceCheckbox.setSelection(fStore.getBoolean(PreferenceConstants.EDITOR_SHOW_TEXT_HOVER_AFFORDANCE));
+ }
+
+ void performOk() {
+ StringBuffer buf= new StringBuffer();
+ StringBuffer maskBuf= new StringBuffer();
+ for (int i= 0; i < fHoverConfigs.length; i++) {
+ buf.append(getContributedHovers()[i].getId());
+ buf.append(JavaEditorTextHoverDescriptor.VALUE_SEPARATOR);
+ if (!fHoverConfigs[i].fIsEnabled)
+ buf.append(JavaEditorTextHoverDescriptor.DISABLED_TAG);
+ String modifier= fHoverConfigs[i].fModifierString;
+ if (modifier == null || modifier.length() == 0)
+ modifier= JavaEditorTextHoverDescriptor.NO_MODIFIER;
+ buf.append(modifier);
+ buf.append(JavaEditorTextHoverDescriptor.VALUE_SEPARATOR);
+
+ maskBuf.append(getContributedHovers()[i].getId());
+ maskBuf.append(JavaEditorTextHoverDescriptor.VALUE_SEPARATOR);
+ maskBuf.append(fHoverConfigs[i].fStateMask);
+ maskBuf.append(JavaEditorTextHoverDescriptor.VALUE_SEPARATOR);
+ }
+ fStore.setValue(PreferenceConstants.EDITOR_TEXT_HOVER_MODIFIERS, buf.toString());
+ fStore.setValue(PreferenceConstants.EDITOR_TEXT_HOVER_MODIFIER_MASKS, maskBuf.toString());
+
+// fStore.setValue(PreferenceConstants.EDITOR_SHOW_TEXT_HOVER_AFFORDANCE, fShowHoverAffordanceCheckbox.getSelection());
+
+ PHPeclipsePlugin.getDefault().resetJavaEditorTextHoverDescriptors();
+ }
+
+ void performDefaults() {
+ restoreFromPreferences();
+ initializeFields();
+ }
+
+ private void restoreFromPreferences() {
+
+// fShowHoverAffordanceCheckbox.setSelection(fStore.getBoolean(PreferenceConstants.EDITOR_SHOW_TEXT_HOVER_AFFORDANCE));
+
+ String compiledTextHoverModifiers= fStore.getString(PreferenceConstants.EDITOR_TEXT_HOVER_MODIFIERS);
+
+ StringTokenizer tokenizer= new StringTokenizer(compiledTextHoverModifiers, JavaEditorTextHoverDescriptor.VALUE_SEPARATOR);
+ HashMap idToModifier= new HashMap(tokenizer.countTokens() / 2);
+
+ while (tokenizer.hasMoreTokens()) {
+ String id= tokenizer.nextToken();
+ if (tokenizer.hasMoreTokens())
+ idToModifier.put(id, tokenizer.nextToken());
+ }
+
+ String compiledTextHoverModifierMasks= PHPeclipsePlugin.getDefault().getPreferenceStore().getString(PreferenceConstants.EDITOR_TEXT_HOVER_MODIFIER_MASKS);
+
+ tokenizer= new StringTokenizer(compiledTextHoverModifierMasks, JavaEditorTextHoverDescriptor.VALUE_SEPARATOR);
+ HashMap idToModifierMask= new HashMap(tokenizer.countTokens() / 2);
+
+ while (tokenizer.hasMoreTokens()) {
+ String id= tokenizer.nextToken();
+ if (tokenizer.hasMoreTokens())
+ idToModifierMask.put(id, tokenizer.nextToken());
+ }
+
+ for (int i= 0; i < fHoverConfigs.length; i++) {
+ String modifierString= (String)idToModifier.get(getContributedHovers()[i].getId());
+ boolean enabled= true;
+ if (modifierString == null)
+ modifierString= JavaEditorTextHoverDescriptor.DISABLED_TAG;
+
+ if (modifierString.startsWith(JavaEditorTextHoverDescriptor.DISABLED_TAG)) {
+ enabled= false;
+ modifierString= modifierString.substring(1);
+ }
+
+ if (modifierString.equals(JavaEditorTextHoverDescriptor.NO_MODIFIER))
+ modifierString= ""; //$NON-NLS-1$
+
+ fHoverConfigs[i].fModifierString= modifierString;
+ fHoverConfigs[i].fIsEnabled= enabled;
+ fHoverConfigs[i].fStateMask= JavaEditorTextHoverDescriptor.computeStateMask(modifierString);
+
+ if (fHoverConfigs[i].fStateMask == -1) {
+ try {
+ fHoverConfigs[i].fStateMask= Integer.parseInt((String)idToModifierMask.get(getContributedHovers()[i].getId()));
+ } catch (NumberFormatException ex) {
+ fHoverConfigs[i].fStateMask= -1;
+ }
+ }
+ }
+ }
+
+ private void handleModifierModified() {
+ int i= fHoverList.getSelectionIndex();
+ String modifiers= fModifierEditor.getText();
+ fHoverConfigs[i].fModifierString= modifiers;
+ fHoverConfigs[i].fStateMask= JavaEditorTextHoverDescriptor.computeStateMask(modifiers);
+ if (fHoverConfigs[i].fIsEnabled && fHoverConfigs[i].fStateMask == -1)
+ fStatus= new StatusInfo(IStatus.ERROR, PreferencesMessages.getFormattedString("JavaEditorHoverConfigurationBlock.modifierIsNotValid", fHoverConfigs[i].fModifierString)); //$NON-NLS-1$
+ else
+ fStatus= new StatusInfo();
+ updateStatus();
+ }
+
+ private void handleHoverListSelection() {
+ int i= fHoverList.getSelectionIndex();
+ boolean enabled= fHoverConfigs[i].fIsEnabled;
+ fEnableField.setSelection(enabled);
+ fModifierEditor.setEnabled(enabled);
+ fModifierEditor.setText(fHoverConfigs[i].fModifierString);
+ String description= getContributedHovers()[i].getDescription();
+ if (description == null)
+ description= ""; //$NON-NLS-1$
+ fDescription.setText(description);
+ }
+
+ IStatus getStatus() {
+ if (fStatus == null)
+ fStatus= new StatusInfo();
+ return fStatus;
+ }
+
+ private void updateStatus() {
+ int i= 0;
+ HashMap stateMasks= new HashMap(fHoverConfigs.length);
+ while (fStatus.isOK() && i < fHoverConfigs.length) {
+ if (fHoverConfigs[i].fIsEnabled) {
+ String label= getContributedHovers()[i].getLabel();
+ Integer stateMask= new Integer(fHoverConfigs[i].fStateMask);
+ if (fHoverConfigs[i].fStateMask == -1)
+ fStatus= new StatusInfo(IStatus.ERROR, PreferencesMessages.getFormattedString("JavaEditorHoverConfigurationBlock.modifierIsNotValidForHover", new String[] {fHoverConfigs[i].fModifierString, label})); //$NON-NLS-1$
+ else if (stateMasks.containsKey(stateMask))
+ fStatus= new StatusInfo(IStatus.ERROR, PreferencesMessages.getFormattedString("JavaEditorHoverConfigurationBlock.duplicateModifier", new String[] {label, (String)stateMasks.get(stateMask)})); //$NON-NLS-1$
+ else
+ stateMasks.put(stateMask, label);
+ }
+ i++;
+ }
+
+ if (fStatus.isOK())
+ fMainPreferencePage.updateStatus(fStatus);
+ else {
+ fMainPreferencePage.setValid(false);
+ StatusUtil.applyToStatusLine(fMainPreferencePage, fStatus);
+ }
+ }
+}
--- /dev/null
+ /*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package net.sourceforge.phpdt.internal.ui.preferences;
+
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.text.Collator;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.SortedSet;
+import java.util.StringTokenizer;
+import java.util.TreeSet;
+
+import net.sourceforge.phpdt.core.JavaCore;
+import net.sourceforge.phpdt.internal.ui.IJavaHelpContextIds;
+import net.sourceforge.phpdt.internal.ui.dialogs.StatusInfo;
+import net.sourceforge.phpdt.internal.ui.dialogs.StatusUtil;
+import net.sourceforge.phpdt.internal.ui.util.TabFolderLayout;
+import net.sourceforge.phpdt.ui.PreferenceConstants;
+import net.sourceforge.phpdt.ui.text.JavaTextTools;
+import net.sourceforge.phpeclipse.PHPeclipsePlugin;
+import net.sourceforge.phpeclipse.phpeditor.EditorUtility;
+import net.sourceforge.phpeclipse.phpeditor.JavaSourceViewer;
+import net.sourceforge.phpeclipse.phpeditor.PHPSourceViewerConfiguration;
+import net.sourceforge.phpeclipse.preferences.ColorEditor;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.source.SourceViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.List;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.ui.help.WorkbenchHelp;
+import org.eclipse.ui.texteditor.AnnotationPreference;
+import org.eclipse.ui.texteditor.ExtendedTextEditorPreferenceConstants;
+import org.eclipse.ui.texteditor.MarkerAnnotationPreferences;
+/**
+ * The page for setting the editor options.
+ */
+public class JavaEditorPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
+
+ private static final String BOLD= PreferenceConstants.EDITOR_BOLD_SUFFIX;
+ private static final String COMPILER_TASK_TAGS= JavaCore.COMPILER_TASK_TAGS;
+ private static final String DELIMITER= PreferencesMessages.getString("JavaEditorPreferencePage.navigation.delimiter"); //$NON-NLS-1$
+
+ /** The keys of the overlay store. */
+ public final OverlayPreferenceStore.OverlayKey[] fKeys;
+ private final String[][] fSyntaxColorListModel= new String[][] {
+ { PreferencesMessages.getString("JavaEditorPreferencePage.multiLineComment"), PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_COLOR }, //$NON-NLS-1$
+ { PreferencesMessages.getString("JavaEditorPreferencePage.singleLineComment"), PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_COLOR }, //$NON-NLS-1$
+ { PreferencesMessages.getString("JavaEditorPreferencePage.keywords"), PreferenceConstants.EDITOR_JAVA_KEYWORD_COLOR }, //$NON-NLS-1$
+ { PreferencesMessages.getString("JavaEditorPreferencePage.strings"), PreferenceConstants.EDITOR_STRING_COLOR }, //$NON-NLS-1$
+// { PreferencesMessages.getString("JavaEditorPreferencePage.methodNames"), PreferenceConstants.EDITOR_JAVA_METHOD_NAME_COLOR }, //$NON-NLS-1$
+// { PreferencesMessages.getString("JavaEditorPreferencePage.operators"), PreferenceConstants.EDITOR_JAVA_OPERATOR_COLOR }, //$NON-NLS-1$
+ { PreferencesMessages.getString("JavaEditorPreferencePage.others"), PreferenceConstants.EDITOR_JAVA_DEFAULT_COLOR }, //$NON-NLS-1$
+// { PreferencesMessages.getString("JavaEditorPreferencePage.javaCommentTaskTags"), PreferenceConstants.EDITOR_TASK_TAG_COLOR }, //$NON-NLS-1$
+ { PreferencesMessages.getString("JavaEditorPreferencePage.javaDocKeywords"), PreferenceConstants.EDITOR_JAVADOC_KEYWORD_COLOR }, //$NON-NLS-1$
+ { PreferencesMessages.getString("JavaEditorPreferencePage.javaDocHtmlTags"), PreferenceConstants.EDITOR_JAVADOC_TAG_COLOR }, //$NON-NLS-1$
+ { PreferencesMessages.getString("JavaEditorPreferencePage.javaDocLinks"), PreferenceConstants.EDITOR_JAVADOC_LINKS_COLOR }, //$NON-NLS-1$
+ { PreferencesMessages.getString("JavaEditorPreferencePage.javaDocOthers"), PreferenceConstants.EDITOR_JAVADOC_DEFAULT_COLOR } //$NON-NLS-1$
+ };
+
+ private final String[][] fAppearanceColorListModel= new String[][] {
+ {PreferencesMessages.getString("JavaEditorPreferencePage.lineNumberForegroundColor"), ExtendedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR}, //$NON-NLS-1$
+ {PreferencesMessages.getString("JavaEditorPreferencePage.matchingBracketsHighlightColor2"), PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR}, //$NON-NLS-1$
+ {PreferencesMessages.getString("JavaEditorPreferencePage.currentLineHighlighColor"), ExtendedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR}, //$NON-NLS-1$
+ {PreferencesMessages.getString("JavaEditorPreferencePage.printMarginColor2"), ExtendedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLOR}, //$NON-NLS-1$
+ {PreferencesMessages.getString("JavaEditorPreferencePage.findScopeColor2"), PreferenceConstants.EDITOR_FIND_SCOPE_COLOR}, //$NON-NLS-1$
+ {PreferencesMessages.getString("JavaEditorPreferencePage.linkColor2"), PreferenceConstants.EDITOR_LINK_COLOR}, //$NON-NLS-1$
+ };
+
+ private final String[][] fAnnotationColorListModel;
+
+ private final String[][] fContentAssistColorListModel= new String[][] {
+ {PreferencesMessages.getString("JavaEditorPreferencePage.backgroundForCompletionProposals"), PreferenceConstants.CODEASSIST_PROPOSALS_BACKGROUND }, //$NON-NLS-1$
+ {PreferencesMessages.getString("JavaEditorPreferencePage.foregroundForCompletionProposals"), PreferenceConstants.CODEASSIST_PROPOSALS_FOREGROUND }, //$NON-NLS-1$
+ {PreferencesMessages.getString("JavaEditorPreferencePage.backgroundForMethodParameters"), PreferenceConstants.CODEASSIST_PARAMETERS_BACKGROUND }, //$NON-NLS-1$
+ {PreferencesMessages.getString("JavaEditorPreferencePage.foregroundForMethodParameters"), PreferenceConstants.CODEASSIST_PARAMETERS_FOREGROUND }, //$NON-NLS-1$
+ {PreferencesMessages.getString("JavaEditorPreferencePage.backgroundForCompletionReplacement"), PreferenceConstants.CODEASSIST_REPLACEMENT_BACKGROUND }, //$NON-NLS-1$
+ {PreferencesMessages.getString("JavaEditorPreferencePage.foregroundForCompletionReplacement"), PreferenceConstants.CODEASSIST_REPLACEMENT_FOREGROUND } //$NON-NLS-1$
+ };
+
+ private final String[][] fAnnotationDecorationListModel= new String[][] {
+ {PreferencesMessages.getString("JavaEditorPreferencePage.AnnotationDecoration.NONE"), AnnotationPreference.STYLE_NONE}, //$NON-NLS-1$
+ {PreferencesMessages.getString("JavaEditorPreferencePage.AnnotationDecoration.SQUIGGLIES"), AnnotationPreference.STYLE_SQUIGGLIES}, //$NON-NLS-1$
+ {PreferencesMessages.getString("JavaEditorPreferencePage.AnnotationDecoration.UNDERLINE"), AnnotationPreference.STYLE_UNDERLINE}, //$NON-NLS-1$
+ {PreferencesMessages.getString("JavaEditorPreferencePage.AnnotationDecoration.BOX"), AnnotationPreference.STYLE_BOX}, //$NON-NLS-1$
+ {PreferencesMessages.getString("JavaEditorPreferencePage.AnnotationDecoration.IBEAM"), AnnotationPreference.STYLE_IBEAM} //$NON-NLS-1$
+ };
+
+ private OverlayPreferenceStore fOverlayStore;
+ private JavaTextTools fJavaTextTools;
+ private JavaEditorHoverConfigurationBlock fJavaEditorHoverConfigurationBlock;
+
+ private Map fColorButtons= new HashMap();
+
+ private Map fCheckBoxes= new HashMap();
+ private SelectionListener fCheckBoxListener= new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ public void widgetSelected(SelectionEvent e) {
+ Button button= (Button) e.widget;
+ fOverlayStore.setValue((String) fCheckBoxes.get(button), button.getSelection());
+ }
+ };
+
+ private Map fTextFields= new HashMap();
+ private ModifyListener fTextFieldListener= new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ Text text= (Text) e.widget;
+ fOverlayStore.setValue((String) fTextFields.get(text), text.getText());
+ }
+ };
+
+ private ArrayList fNumberFields= new ArrayList();
+ private ModifyListener fNumberFieldListener= new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ numberFieldChanged((Text) e.widget);
+ }
+ };
+
+ private List fSyntaxColorList;
+ private List fAppearanceColorList;
+ private List fContentAssistColorList;
+ private List fAnnotationList;
+ private ColorEditor fSyntaxForegroundColorEditor;
+ private ColorEditor fAppearanceColorEditor;
+ private ColorEditor fAnnotationForegroundColorEditor;
+ private ColorEditor fContentAssistColorEditor;
+ private ColorEditor fBackgroundColorEditor;
+ private Button fBackgroundDefaultRadioButton;
+ private Button fBackgroundCustomRadioButton;
+ private Button fBackgroundColorButton;
+ private Button fBoldCheckBox;
+// private Button fAddJavaDocTagsButton;
+// private Button fEscapeStringsButton;
+// private Button fGuessMethodArgumentsButton;
+ private SourceViewer fPreviewViewer;
+ private Color fBackgroundColor;
+ private Control fAutoInsertDelayText;
+ private Control fAutoInsertJavaTriggerText;
+ private Control fAutoInsertJavaDocTriggerText;
+ private Label fAutoInsertDelayLabel;
+ private Label fAutoInsertJavaTriggerLabel;
+ private Label fAutoInsertJavaDocTriggerLabel;
+ private Button fShowInTextCheckBox;
+ private Combo fDecorationStyleCombo;
+ private Button fHighlightInTextCheckBox;
+ private Button fShowInOverviewRulerCheckBox;
+ private Button fShowInVerticalRulerCheckBox;
+// private Text fBrowserLikeLinksKeyModifierText;
+// private Button fBrowserLikeLinksCheckBox;
+// private StatusInfo fBrowserLikeLinksKeyModifierStatus;
+// private Button fCompletionInsertsRadioButton;
+// private Button fCompletionOverwritesRadioButton;
+// private Button fStickyOccurrencesButton;
+
+ /**
+ * Creates a new preference page.
+ */
+ public JavaEditorPreferencePage() {
+ setDescription(PreferencesMessages.getString("JavaEditorPreferencePage.description")); //$NON-NLS-1$
+ setPreferenceStore(PHPeclipsePlugin.getDefault().getPreferenceStore());
+
+ MarkerAnnotationPreferences markerAnnotationPreferences= new MarkerAnnotationPreferences();
+ fKeys= createOverlayStoreKeys(markerAnnotationPreferences);
+ fOverlayStore= new OverlayPreferenceStore(getPreferenceStore(), fKeys);
+ fAnnotationColorListModel= createAnnotationTypeListModel(markerAnnotationPreferences);
+ }
+
+ private OverlayPreferenceStore.OverlayKey[] createOverlayStoreKeys(MarkerAnnotationPreferences preferences) {
+
+ ArrayList overlayKeys= new ArrayList();
+ Iterator e= preferences.getAnnotationPreferences().iterator();
+
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_FOREGROUND_COLOR));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_FOREGROUND_DEFAULT_COLOR));
+
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_BACKGROUND_COLOR));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_BACKGROUND_DEFAULT_COLOR));
+
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT, PreferenceConstants.EDITOR_TAB_WIDTH));
+
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_COLOR));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_BOLD));
+
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_COLOR));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_BOLD));
+
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVA_KEYWORD_COLOR));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVA_KEYWORD_BOLD));
+
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_STRING_COLOR));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_STRING_BOLD));
+
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVA_DEFAULT_COLOR));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVA_DEFAULT_BOLD));
+
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_TASK_TAG_COLOR));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_TASK_TAG_BOLD));
+
+// overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVA_METHOD_NAME_COLOR));
+// overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVA_METHOD_NAME_BOLD));
+
+// overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVA_OPERATOR_COLOR));
+// overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVA_OPERATOR_BOLD));
+
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVADOC_KEYWORD_COLOR));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVADOC_KEYWORD_BOLD));
+
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVADOC_TAG_COLOR));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVADOC_TAG_BOLD));
+
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVADOC_LINKS_COLOR));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVADOC_LINKS_BOLD));
+
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVADOC_DEFAULT_COLOR));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVADOC_DEFAULT_BOLD));
+
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_MATCHING_BRACKETS));
+
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, ExtendedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, ExtendedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE));
+
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, ExtendedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLOR));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT, ExtendedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, ExtendedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN));
+
+// overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_MARK_OCCURRENCES));
+// overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_STICKY_OCCURRENCES));
+
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_FIND_SCOPE_COLOR));
+
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_LINK_COLOR));
+
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CORRECTION_INDICATION));
+
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_EVALUTE_TEMPORARY_PROBLEMS));
+
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, ExtendedTextEditorPreferenceConstants.EDITOR_OVERVIEW_RULER));
+
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, ExtendedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, ExtendedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER));
+
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SPACES_FOR_TABS));
+
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_AUTOACTIVATION));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT, PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_AUTOINSERT));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_PROPOSALS_BACKGROUND));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_PROPOSALS_FOREGROUND));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_PARAMETERS_BACKGROUND));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_PARAMETERS_FOREGROUND));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_REPLACEMENT_BACKGROUND));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_REPLACEMENT_FOREGROUND));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVADOC));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_SHOW_VISIBLE_PROPOSALS));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_ORDER_PROPOSALS));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_CASE_SENSITIVITY));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_ADDIMPORT));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_INSERT_COMPLETION));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_GUESS_METHOD_ARGUMENTS));
+
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SMART_PASTE));
+// overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CLOSE_STRINGS));
+// overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CLOSE_BRACKETS));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CLOSE_BRACES));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CLOSE_JAVADOCS));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_WRAP_STRINGS));
+// overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_ESCAPE_STRINGS));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_ADD_JAVADOC_TAGS));
+
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SMART_HOME_END));
+// overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SUB_WORD_NAVIGATION));
+
+// overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_DISABLE_OVERWRITE_MODE));
+
+// overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SHOW_TEXT_HOVER_AFFORDANCE));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_TEXT_HOVER_MODIFIERS));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_TEXT_HOVER_MODIFIER_MASKS));
+
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_BROWSER_LIKE_LINKS));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_BROWSER_LIKE_LINKS_KEY_MODIFIER));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_BROWSER_LIKE_LINKS_KEY_MODIFIER_MASK));
+
+ while (e.hasNext()) {
+ AnnotationPreference info= (AnnotationPreference) e.next();
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, info.getColorPreferenceKey()));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, info.getTextPreferenceKey()));
+ if (info.getHighlightPreferenceKey() != null)
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, info.getHighlightPreferenceKey()));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, info.getOverviewRulerPreferenceKey()));
+ if (info.getVerticalRulerPreferenceKey() != null)
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, info.getVerticalRulerPreferenceKey()));
+ if (info.getTextStylePreferenceKey() != null)
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, info.getTextStylePreferenceKey()));
+ }
+ OverlayPreferenceStore.OverlayKey[] keys= new OverlayPreferenceStore.OverlayKey[overlayKeys.size()];
+ overlayKeys.toArray(keys);
+ return keys;
+ } /*
+ * @see IWorkbenchPreferencePage#init()
+ */
+ public void init(IWorkbench workbench) {
+ }
+
+ /*
+ * @see PreferencePage#createControl(Composite)
+ */
+ public void createControl(Composite parent) {
+ super.createControl(parent);
+ WorkbenchHelp.setHelp(getControl(), IJavaHelpContextIds.JAVA_EDITOR_PREFERENCE_PAGE);
+ }
+
+ private void handleSyntaxColorListSelection() {
+ int i= fSyntaxColorList.getSelectionIndex();
+ String key= fSyntaxColorListModel[i][1];
+ RGB rgb= PreferenceConverter.getColor(fOverlayStore, key);
+ fSyntaxForegroundColorEditor.setColorValue(rgb);
+ fBoldCheckBox.setSelection(fOverlayStore.getBoolean(key + BOLD));
+ }
+
+ private void handleAppearanceColorListSelection() {
+ int i= fAppearanceColorList.getSelectionIndex();
+ String key= fAppearanceColorListModel[i][1];
+ RGB rgb= PreferenceConverter.getColor(fOverlayStore, key);
+ fAppearanceColorEditor.setColorValue(rgb);
+ }
+
+ private void handleContentAssistColorListSelection() {
+ int i= fContentAssistColorList.getSelectionIndex();
+ String key= fContentAssistColorListModel[i][1];
+ RGB rgb= PreferenceConverter.getColor(fOverlayStore, key);
+ fContentAssistColorEditor.setColorValue(rgb);
+ }
+
+ private void handleAnnotationListSelection() {
+ int i= fAnnotationList.getSelectionIndex();
+
+ String key= fAnnotationColorListModel[i][1];
+ RGB rgb= PreferenceConverter.getColor(fOverlayStore, key);
+ fAnnotationForegroundColorEditor.setColorValue(rgb);
+
+ key= fAnnotationColorListModel[i][2];
+ boolean showInText = fOverlayStore.getBoolean(key);
+ fShowInTextCheckBox.setSelection(showInText);
+
+ key= fAnnotationColorListModel[i][6];
+ if (key != null) {
+ fDecorationStyleCombo.setEnabled(showInText);
+ for (int j= 0; j < fAnnotationDecorationListModel.length; j++) {
+ String value= fOverlayStore.getString(key);
+ if (fAnnotationDecorationListModel[j][1].equals(value)) {
+ fDecorationStyleCombo.setText(fAnnotationDecorationListModel[j][0]);
+ break;
+ }
+ }
+ } else {
+ fDecorationStyleCombo.setEnabled(false);
+ fDecorationStyleCombo.setText(fAnnotationDecorationListModel[1][0]); // set selection to squigglies if the key is not there (legacy support)
+ }
+
+ key= fAnnotationColorListModel[i][3];
+ fShowInOverviewRulerCheckBox.setSelection(fOverlayStore.getBoolean(key));
+
+ key= fAnnotationColorListModel[i][4];
+ if (key != null) {
+ fHighlightInTextCheckBox.setSelection(fOverlayStore.getBoolean(key));
+ fHighlightInTextCheckBox.setEnabled(true);
+ } else
+ fHighlightInTextCheckBox.setEnabled(false);
+
+ key= fAnnotationColorListModel[i][5];
+ if (key != null) {
+ fShowInVerticalRulerCheckBox.setSelection(fOverlayStore.getBoolean(key));
+ fShowInVerticalRulerCheckBox.setEnabled(true);
+ } else {
+ fShowInVerticalRulerCheckBox.setSelection(true);
+ fShowInVerticalRulerCheckBox.setEnabled(false);
+ }
+ }
+
+ private Control createSyntaxPage(Composite parent) {
+
+ Composite colorComposite= new Composite(parent, SWT.NULL);
+ colorComposite.setLayout(new GridLayout());
+
+ Group backgroundComposite= new Group(colorComposite, SWT.SHADOW_ETCHED_IN);
+ backgroundComposite.setLayout(new RowLayout());
+ backgroundComposite.setText(PreferencesMessages.getString("JavaEditorPreferencePage.backgroundColor"));//$NON-NLS-1$
+
+ SelectionListener backgroundSelectionListener= new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ boolean custom= fBackgroundCustomRadioButton.getSelection();
+ fBackgroundColorButton.setEnabled(custom);
+ fOverlayStore.setValue(PreferenceConstants.EDITOR_BACKGROUND_DEFAULT_COLOR, !custom);
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {}
+ };
+
+ fBackgroundDefaultRadioButton= new Button(backgroundComposite, SWT.RADIO | SWT.LEFT);
+ fBackgroundDefaultRadioButton.setText(PreferencesMessages.getString("JavaEditorPreferencePage.systemDefault")); //$NON-NLS-1$
+ fBackgroundDefaultRadioButton.addSelectionListener(backgroundSelectionListener);
+
+ fBackgroundCustomRadioButton= new Button(backgroundComposite, SWT.RADIO | SWT.LEFT);
+ fBackgroundCustomRadioButton.setText(PreferencesMessages.getString("JavaEditorPreferencePage.custom")); //$NON-NLS-1$
+ fBackgroundCustomRadioButton.addSelectionListener(backgroundSelectionListener);
+
+ fBackgroundColorEditor= new ColorEditor(backgroundComposite);
+ fBackgroundColorButton= fBackgroundColorEditor.getButton();
+
+ Label label= new Label(colorComposite, SWT.LEFT);
+ label.setText(PreferencesMessages.getString("JavaEditorPreferencePage.foreground")); //$NON-NLS-1$
+ label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ Composite editorComposite= new Composite(colorComposite, SWT.NONE);
+ GridLayout layout= new GridLayout();
+ layout.numColumns= 2;
+ layout.marginHeight= 0;
+ layout.marginWidth= 0;
+ editorComposite.setLayout(layout);
+ GridData gd= new GridData(GridData.FILL_BOTH);
+ editorComposite.setLayoutData(gd);
+
+ fSyntaxColorList= new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER);
+ gd= new GridData(GridData.FILL_BOTH);
+ gd.heightHint= convertHeightInCharsToPixels(5);
+ fSyntaxColorList.setLayoutData(gd);
+
+ Composite stylesComposite= new Composite(editorComposite, SWT.NONE);
+ layout= new GridLayout();
+ layout.marginHeight= 0;
+ layout.marginWidth= 0;
+ layout.numColumns= 2;
+ stylesComposite.setLayout(layout);
+ stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ label= new Label(stylesComposite, SWT.LEFT);
+ label.setText(PreferencesMessages.getString("JavaEditorPreferencePage.color")); //$NON-NLS-1$
+ gd= new GridData();
+ gd.horizontalAlignment= GridData.BEGINNING;
+ label.setLayoutData(gd);
+
+ fSyntaxForegroundColorEditor= new ColorEditor(stylesComposite);
+ Button foregroundColorButton= fSyntaxForegroundColorEditor.getButton();
+ gd= new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalAlignment= GridData.BEGINNING;
+ foregroundColorButton.setLayoutData(gd);
+
+ fBoldCheckBox= new Button(stylesComposite, SWT.CHECK);
+ fBoldCheckBox.setText(PreferencesMessages.getString("JavaEditorPreferencePage.bold")); //$NON-NLS-1$
+ gd= new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalAlignment= GridData.BEGINNING;
+ gd.horizontalSpan= 2;
+ fBoldCheckBox.setLayoutData(gd);
+
+ label= new Label(colorComposite, SWT.LEFT);
+ label.setText(PreferencesMessages.getString("JavaEditorPreferencePage.preview")); //$NON-NLS-1$
+ label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ Control previewer= createPreviewer(colorComposite);
+ gd= new GridData(GridData.FILL_BOTH);
+ gd.widthHint= convertWidthInCharsToPixels(20);
+ gd.heightHint= convertHeightInCharsToPixels(5);
+ previewer.setLayoutData(gd);
+
+
+ fSyntaxColorList.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // do nothing
+ }
+ public void widgetSelected(SelectionEvent e) {
+ handleSyntaxColorListSelection();
+ }
+ });
+
+ foregroundColorButton.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // do nothing
+ }
+ public void widgetSelected(SelectionEvent e) {
+ int i= fSyntaxColorList.getSelectionIndex();
+ String key= fSyntaxColorListModel[i][1];
+
+ PreferenceConverter.setValue(fOverlayStore, key, fSyntaxForegroundColorEditor.getColorValue());
+ }
+ });
+
+ fBackgroundColorButton.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // do nothing
+ }
+ public void widgetSelected(SelectionEvent e) {
+ PreferenceConverter.setValue(fOverlayStore, PreferenceConstants.EDITOR_BACKGROUND_COLOR, fBackgroundColorEditor.getColorValue());
+ }
+ });
+
+ fBoldCheckBox.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // do nothing
+ }
+ public void widgetSelected(SelectionEvent e) {
+ int i= fSyntaxColorList.getSelectionIndex();
+ String key= fSyntaxColorListModel[i][1];
+ fOverlayStore.setValue(key + BOLD, fBoldCheckBox.getSelection());
+ }
+ });
+
+ return colorComposite;
+ }
+
+ private Control createPreviewer(Composite parent) {
+
+ Preferences coreStore= createTemporaryCorePreferenceStore();
+
+ fJavaTextTools= new JavaTextTools(fOverlayStore, coreStore, false);
+
+ fPreviewViewer= new JavaSourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
+ fPreviewViewer.configure(new PHPSourceViewerConfiguration(fJavaTextTools, null));
+// Font font= JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT);
+// fPreviewViewer.getTextWidget().setFont(font);
+ fPreviewViewer.getTextWidget().setFont(
+ JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT));
+
+// new JavaSourcePreviewerUpdater(fPreviewViewer, fJavaTextTools);
+ fPreviewViewer.setEditable(false);
+
+ String content= loadPreviewContentFromFile("ColorSettingPreviewCode.txt"); //$NON-NLS-1$
+ IDocument document= new Document(content);
+ fJavaTextTools.setupJavaDocumentPartitioner(document, ".php"); //IJavaPartitions.JAVA_PARTITIONING);
+ fPreviewViewer.setDocument(document);
+
+ return fPreviewViewer.getControl();
+ }
+
+ private Preferences createTemporaryCorePreferenceStore() {
+ Preferences result= new Preferences();
+
+ result.setValue(COMPILER_TASK_TAGS, "TASK"); //$NON-NLS-1$
+
+ return result;
+ }
+
+ private Control createAppearancePage(Composite parent) {
+
+ Composite appearanceComposite= new Composite(parent, SWT.NONE);
+ GridLayout layout= new GridLayout(); layout.numColumns= 2;
+ appearanceComposite.setLayout(layout);
+
+ String label= PreferencesMessages.getString("JavaEditorPreferencePage.displayedTabWidth"); //$NON-NLS-1$
+ addTextField(appearanceComposite, label, PreferenceConstants.EDITOR_TAB_WIDTH, 3, 0, true);
+
+ label= PreferencesMessages.getString("JavaEditorPreferencePage.printMarginColumn"); //$NON-NLS-1$
+ addTextField(appearanceComposite, label, ExtendedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN, 3, 0, true);
+
+ label= PreferencesMessages.getString("JavaEditorPreferencePage.showOverviewRuler"); //$NON-NLS-1$
+ addCheckBox(appearanceComposite, label, ExtendedTextEditorPreferenceConstants.EDITOR_OVERVIEW_RULER, 0);
+
+ label= PreferencesMessages.getString("JavaEditorPreferencePage.showLineNumbers"); //$NON-NLS-1$
+ addCheckBox(appearanceComposite, label, ExtendedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER, 0);
+
+ label= PreferencesMessages.getString("JavaEditorPreferencePage.highlightMatchingBrackets"); //$NON-NLS-1$
+ addCheckBox(appearanceComposite, label, PreferenceConstants.EDITOR_MATCHING_BRACKETS, 0);
+
+ label= PreferencesMessages.getString("JavaEditorPreferencePage.highlightCurrentLine"); //$NON-NLS-1$
+ addCheckBox(appearanceComposite, label, ExtendedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE, 0);
+
+ label= PreferencesMessages.getString("JavaEditorPreferencePage.showPrintMargin"); //$NON-NLS-1$
+ addCheckBox(appearanceComposite, label, ExtendedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN, 0);
+
+ label= PreferencesMessages.getString("JavaEditorPreferencePage.markOccurrences"); //$NON-NLS-1$
+// Button master= addCheckBox(appearanceComposite, label, PreferenceConstants.EDITOR_MARK_OCCURRENCES, 0); //$NON-NLS-1$
+
+ label= PreferencesMessages.getString("JavaEditorPreferencePage.stickyOccurrences"); //$NON-NLS-1$
+// fStickyOccurrencesButton= addCheckBox(appearanceComposite, label, PreferenceConstants.EDITOR_STICKY_OCCURRENCES, 0); //$NON-NLS-1$
+// createDependency(master, fStickyOccurrencesButton);
+
+ Label l= new Label(appearanceComposite, SWT.LEFT );
+ GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ gd.horizontalSpan= 2;
+ gd.heightHint= convertHeightInCharsToPixels(1) / 2;
+ l.setLayoutData(gd);
+
+ l= new Label(appearanceComposite, SWT.LEFT);
+ l.setText(PreferencesMessages.getString("JavaEditorPreferencePage.appearanceOptions")); //$NON-NLS-1$
+ gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ gd.horizontalSpan= 2;
+ l.setLayoutData(gd);
+
+ Composite editorComposite= new Composite(appearanceComposite, SWT.NONE);
+ layout= new GridLayout();
+ layout.numColumns= 2;
+ layout.marginHeight= 0;
+ layout.marginWidth= 0;
+ editorComposite.setLayout(layout);
+ gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL);
+ gd.horizontalSpan= 2;
+ editorComposite.setLayoutData(gd);
+
+ fAppearanceColorList= new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER);
+ gd= new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
+ gd.heightHint= convertHeightInCharsToPixels(8);
+ fAppearanceColorList.setLayoutData(gd);
+
+ Composite stylesComposite= new Composite(editorComposite, SWT.NONE);
+ layout= new GridLayout();
+ layout.marginHeight= 0;
+ layout.marginWidth= 0;
+ layout.numColumns= 2;
+ stylesComposite.setLayout(layout);
+ stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ l= new Label(stylesComposite, SWT.LEFT);
+ l.setText(PreferencesMessages.getString("JavaEditorPreferencePage.color")); //$NON-NLS-1$
+ gd= new GridData();
+ gd.horizontalAlignment= GridData.BEGINNING;
+ l.setLayoutData(gd);
+
+ fAppearanceColorEditor= new ColorEditor(stylesComposite);
+ Button foregroundColorButton= fAppearanceColorEditor.getButton();
+ gd= new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalAlignment= GridData.BEGINNING;
+ foregroundColorButton.setLayoutData(gd);
+
+ fAppearanceColorList.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // do nothing
+ }
+ public void widgetSelected(SelectionEvent e) {
+ handleAppearanceColorListSelection();
+ }
+ });
+ foregroundColorButton.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // do nothing
+ }
+ public void widgetSelected(SelectionEvent e) {
+ int i= fAppearanceColorList.getSelectionIndex();
+ String key= fAppearanceColorListModel[i][1];
+
+ PreferenceConverter.setValue(fOverlayStore, key, fAppearanceColorEditor.getColorValue());
+ }
+ });
+ return appearanceComposite;
+ }
+
+
+ private Control createAnnotationsPage(Composite parent) {
+ Composite composite= new Composite(parent, SWT.NULL);
+ GridLayout layout= new GridLayout(); layout.numColumns= 2;
+ composite.setLayout(layout);
+
+ String text= PreferencesMessages.getString("JavaEditorPreferencePage.analyseAnnotationsWhileTyping"); //$NON-NLS-1$
+ addCheckBox(composite, text, PreferenceConstants.EDITOR_EVALUTE_TEMPORARY_PROBLEMS, 0);
+
+ text= PreferencesMessages.getString("JavaEditorPreferencePage.showQuickFixables"); //$NON-NLS-1$
+ addCheckBox(composite, text, PreferenceConstants.EDITOR_CORRECTION_INDICATION, 0);
+
+ addFiller(composite);
+
+ Label label= new Label(composite, SWT.LEFT);
+ label.setText(PreferencesMessages.getString("JavaEditorPreferencePage.annotationPresentationOptions")); //$NON-NLS-1$
+ GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ gd.horizontalSpan= 2;
+ label.setLayoutData(gd);
+
+ Composite editorComposite= new Composite(composite, SWT.NONE);
+ layout= new GridLayout();
+ layout.numColumns= 2;
+ layout.marginHeight= 0;
+ layout.marginWidth= 0;
+ editorComposite.setLayout(layout);
+ gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL);
+ gd.horizontalSpan= 2;
+ editorComposite.setLayoutData(gd);
+
+ fAnnotationList= new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER);
+ gd= new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
+ gd.heightHint= convertHeightInCharsToPixels(10);
+ fAnnotationList.setLayoutData(gd);
+
+ Composite optionsComposite= new Composite(editorComposite, SWT.NONE);
+ layout= new GridLayout();
+ layout.marginHeight= 0;
+ layout.marginWidth= 0;
+ layout.numColumns= 2;
+ optionsComposite.setLayout(layout);
+ optionsComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ fShowInTextCheckBox= new Button(optionsComposite, SWT.CHECK);
+ fShowInTextCheckBox.setText(PreferencesMessages.getString("JavaEditorPreferencePage.annotations.showInText")); //$NON-NLS-1$
+ gd= new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalAlignment= GridData.BEGINNING;
+ gd.horizontalSpan= 2;
+ fShowInTextCheckBox.setLayoutData(gd);
+
+ fDecorationStyleCombo= new Combo(optionsComposite, SWT.READ_ONLY);
+ for(int i= 0; i < fAnnotationDecorationListModel.length; i++)
+ fDecorationStyleCombo.add(fAnnotationDecorationListModel[i][0]);
+ gd= new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalAlignment= GridData.BEGINNING;
+ gd.horizontalSpan= 2;
+ gd.horizontalIndent= 20;
+ fDecorationStyleCombo.setLayoutData(gd);
+
+ fHighlightInTextCheckBox= new Button(optionsComposite, SWT.CHECK);
+ fHighlightInTextCheckBox.setText(PreferencesMessages.getString("TextEditorPreferencePage.annotations.highlightInText")); //$NON-NLS-1$
+ gd= new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalAlignment= GridData.BEGINNING;
+ gd.horizontalSpan= 2;
+ fHighlightInTextCheckBox.setLayoutData(gd);
+
+ fShowInOverviewRulerCheckBox= new Button(optionsComposite, SWT.CHECK);
+ fShowInOverviewRulerCheckBox.setText(PreferencesMessages.getString("JavaEditorPreferencePage.annotations.showInOverviewRuler")); //$NON-NLS-1$
+ gd= new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalAlignment= GridData.BEGINNING;
+ gd.horizontalSpan= 2;
+ fShowInOverviewRulerCheckBox.setLayoutData(gd);
+
+ fShowInVerticalRulerCheckBox= new Button(optionsComposite, SWT.CHECK);
+ fShowInVerticalRulerCheckBox.setText(PreferencesMessages.getString("JavaEditorPreferencePage.annotations.showInVerticalRuler")); //$NON-NLS-1$
+ gd= new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalAlignment= GridData.BEGINNING;
+ gd.horizontalSpan= 2;
+ fShowInVerticalRulerCheckBox.setLayoutData(gd);
+
+ label= new Label(optionsComposite, SWT.LEFT);
+ label.setText(PreferencesMessages.getString("JavaEditorPreferencePage.annotations.color")); //$NON-NLS-1$
+ gd= new GridData();
+ gd.horizontalAlignment= GridData.BEGINNING;
+ label.setLayoutData(gd);
+
+ fAnnotationForegroundColorEditor= new ColorEditor(optionsComposite);
+ Button foregroundColorButton= fAnnotationForegroundColorEditor.getButton();
+ gd= new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalAlignment= GridData.BEGINNING;
+ foregroundColorButton.setLayoutData(gd);
+
+ fAnnotationList.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // do nothing
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ handleAnnotationListSelection();
+ }
+ });
+
+ fShowInTextCheckBox.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // do nothing
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ int i= fAnnotationList.getSelectionIndex();
+ String key= fAnnotationColorListModel[i][2];
+ fOverlayStore.setValue(key, fShowInTextCheckBox.getSelection());
+ String decorationKey= fAnnotationColorListModel[i][6];
+ fDecorationStyleCombo.setEnabled(decorationKey != null && fShowInTextCheckBox.getSelection());
+ }
+ });
+
+ fHighlightInTextCheckBox.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // do nothing
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ int i= fAnnotationList.getSelectionIndex();
+ String key= fAnnotationColorListModel[i][4];
+ fOverlayStore.setValue(key, fHighlightInTextCheckBox.getSelection());
+ }
+ });
+
+ fShowInOverviewRulerCheckBox.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // do nothing
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ int i= fAnnotationList.getSelectionIndex();
+ String key= fAnnotationColorListModel[i][3];
+ fOverlayStore.setValue(key, fShowInOverviewRulerCheckBox.getSelection());
+ }
+ });
+
+ fShowInVerticalRulerCheckBox.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // do nothing
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ int i= fAnnotationList.getSelectionIndex();
+ String key= fAnnotationColorListModel[i][5];
+ fOverlayStore.setValue(key, fShowInVerticalRulerCheckBox.getSelection());
+ }
+ });
+
+ foregroundColorButton.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // do nothing
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ int i= fAnnotationList.getSelectionIndex();
+ String key= fAnnotationColorListModel[i][1];
+ PreferenceConverter.setValue(fOverlayStore, key, fAnnotationForegroundColorEditor.getColorValue());
+ }
+ });
+
+ fDecorationStyleCombo.addSelectionListener(new SelectionListener() {
+ /**
+ * {@inheritdoc}
+ */
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // do nothing
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public void widgetSelected(SelectionEvent e) {
+ int i= fAnnotationList.getSelectionIndex();
+ String key= fAnnotationColorListModel[i][6];
+ if (key != null) {
+ for (int j= 0; j < fAnnotationDecorationListModel.length; j++) {
+ if (fAnnotationDecorationListModel[j][0].equals(fDecorationStyleCombo.getText())) {
+ fOverlayStore.setValue(key, fAnnotationDecorationListModel[j][1]);
+ break;
+ }
+ }
+ }
+ }
+ });
+
+ return composite;
+ }
+
+ private String[][] createAnnotationTypeListModel(MarkerAnnotationPreferences preferences) {
+ ArrayList listModelItems= new ArrayList();
+ SortedSet sortedPreferences= new TreeSet(new Comparator() {
+ /*
+ * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+ */
+ public int compare(Object o1, Object o2) {
+ if (!(o2 instanceof AnnotationPreference))
+ return -1;
+ if (!(o1 instanceof AnnotationPreference))
+ return 1;
+
+ AnnotationPreference a1= (AnnotationPreference)o1;
+ AnnotationPreference a2= (AnnotationPreference)o2;
+
+ return Collator.getInstance().compare(a1.getPreferenceLabel(), a2.getPreferenceLabel());
+
+ }
+ });
+ sortedPreferences.addAll(preferences.getAnnotationPreferences());
+ Iterator e= sortedPreferences.iterator();
+ while (e.hasNext()) {
+ AnnotationPreference info= (AnnotationPreference) e.next();
+ listModelItems.add(new String[] { info.getPreferenceLabel(), info.getColorPreferenceKey(), info.getTextPreferenceKey(), info.getOverviewRulerPreferenceKey(), info.getHighlightPreferenceKey(), info.getVerticalRulerPreferenceKey(), info.getTextStylePreferenceKey()});
+ }
+ String[][] items= new String[listModelItems.size()][];
+ listModelItems.toArray(items);
+ return items;
+ }
+
+ private Control createTypingPage(Composite parent) {
+ Composite composite= new Composite(parent, SWT.NONE);
+ GridLayout layout= new GridLayout();
+ layout.numColumns= 1;
+ composite.setLayout(layout);
+
+// String label= PreferencesMessages.getString("JavaEditorPreferencePage.overwriteMode"); //$NON-NLS-1$
+// addCheckBox(composite, label, PreferenceConstants.EDITOR_DISABLE_OVERWRITE_MODE, 1);
+
+// addFiller(composite);
+//
+// label= PreferencesMessages.getString("JavaEditorPreferencePage.smartHomeEnd"); //$NON-NLS-1$
+// addCheckBox(composite, label, PreferenceConstants.EDITOR_SMART_HOME_END, 1);
+//
+// label= PreferencesMessages.getString("JavaEditorPreferencePage.subWordNavigation"); //$NON-NLS-1$
+// addCheckBox(composite, label, PreferenceConstants.EDITOR_SUB_WORD_NAVIGATION, 1);
+
+ addFiller(composite);
+
+ Group group= new Group(composite, SWT.NONE);
+ layout= new GridLayout();
+ layout.numColumns= 2;
+ group.setLayout(layout);
+
+ group.setText(PreferencesMessages.getString("JavaEditorPreferencePage.typing.description")); //$NON-NLS-1$
+
+// label= PreferencesMessages.getString("JavaEditorPreferencePage.wrapStrings"); //$NON-NLS-1$
+// Button button= addCheckBox(group, label, PreferenceConstants.EDITOR_WRAP_STRINGS, 1);
+//
+// label= PreferencesMessages.getString("JavaEditorPreferencePage.escapeStrings"); //$NON-NLS-1$
+// fEscapeStringsButton= addCheckBox(group, label, PreferenceConstants.EDITOR_ESCAPE_STRINGS, 1);
+// createDependency(button, fEscapeStringsButton);
+//
+// label= PreferencesMessages.getString("JavaEditorPreferencePage.smartPaste"); //$NON-NLS-1$
+// addCheckBox(group, label, PreferenceConstants.EDITOR_SMART_PASTE, 1);
+//
+// label= PreferencesMessages.getString("JavaEditorPreferencePage.insertSpaceForTabs"); //$NON-NLS-1$
+// addCheckBox(group, label, PreferenceConstants.EDITOR_SPACES_FOR_TABS, 1);
+//
+// label= PreferencesMessages.getString("JavaEditorPreferencePage.closeStrings"); //$NON-NLS-1$
+// addCheckBox(group, label, PreferenceConstants.EDITOR_CLOSE_STRINGS, 1);
+//
+// label= PreferencesMessages.getString("JavaEditorPreferencePage.closeBrackets"); //$NON-NLS-1$
+// addCheckBox(group, label, PreferenceConstants.EDITOR_CLOSE_BRACKETS, 1);
+//
+// label= PreferencesMessages.getString("JavaEditorPreferencePage.closeBraces"); //$NON-NLS-1$
+// addCheckBox(group, label, PreferenceConstants.EDITOR_CLOSE_BRACES, 1);
+//
+// label= PreferencesMessages.getString("JavaEditorPreferencePage.closeJavaDocs"); //$NON-NLS-1$
+// button= addCheckBox(group, label, PreferenceConstants.EDITOR_CLOSE_JAVADOCS, 1);
+//
+// label= PreferencesMessages.getString("JavaEditorPreferencePage.addJavaDocTags"); //$NON-NLS-1$
+// fAddJavaDocTagsButton= addCheckBox(group, label, PreferenceConstants.EDITOR_ADD_JAVADOC_TAGS, 1);
+// createDependency(button, fAddJavaDocTagsButton);
+
+ return composite;
+ }
+ private void addFiller(Composite composite) {
+ Label filler= new Label(composite, SWT.LEFT );
+ GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ gd.horizontalSpan= 2;
+ gd.heightHint= convertHeightInCharsToPixels(1) / 2;
+ filler.setLayoutData(gd);
+ }
+
+ private static void indent(Control control) {
+ GridData gridData= new GridData();
+ gridData.horizontalIndent= 20;
+ control.setLayoutData(gridData);
+ }
+
+ private static void createDependency(final Button master, final Control slave) {
+ indent(slave);
+ master.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ slave.setEnabled(master.getSelection());
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {}
+ });
+ }
+
+ private Control createContentAssistPage(Composite parent) {
+
+ Composite contentAssistComposite= new Composite(parent, SWT.NULL);
+ GridLayout layout= new GridLayout();
+ layout.numColumns= 2;
+ contentAssistComposite.setLayout(layout);
+
+ addCompletionRadioButtons(contentAssistComposite);
+
+ String label;
+ label= PreferencesMessages.getString("JavaEditorPreferencePage.insertSingleProposalsAutomatically"); //$NON-NLS-1$
+ addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOINSERT, 0);
+
+ label= PreferencesMessages.getString("JavaEditorPreferencePage.showOnlyProposalsVisibleInTheInvocationContext"); //$NON-NLS-1$
+ addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_SHOW_VISIBLE_PROPOSALS, 0);
+
+ label= PreferencesMessages.getString("JavaEditorPreferencePage.presentProposalsInAlphabeticalOrder"); //$NON-NLS-1$
+ addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_ORDER_PROPOSALS, 0);
+
+ label= PreferencesMessages.getString("JavaEditorPreferencePage.automaticallyAddImportInsteadOfQualifiedName"); //$NON-NLS-1$
+ addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_ADDIMPORT, 0);
+
+ label= PreferencesMessages.getString("JavaEditorPreferencePage.fillArgumentNamesOnMethodCompletion"); //$NON-NLS-1$
+ Button button= addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES, 0);
+
+ label= PreferencesMessages.getString("JavaEditorPreferencePage.guessArgumentNamesOnMethodCompletion"); //$NON-NLS-1$
+// fGuessMethodArgumentsButton= addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_GUESS_METHOD_ARGUMENTS, 0);
+// createDependency(button, fGuessMethodArgumentsButton);
+
+ label= PreferencesMessages.getString("JavaEditorPreferencePage.enableAutoActivation"); //$NON-NLS-1$
+ final Button autoactivation= addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOACTIVATION, 0);
+ autoactivation.addSelectionListener(new SelectionAdapter(){
+ public void widgetSelected(SelectionEvent e) {
+ updateAutoactivationControls();
+ }
+ });
+
+ Control[] labelledTextField;
+ label= PreferencesMessages.getString("JavaEditorPreferencePage.autoActivationDelay"); //$NON-NLS-1$
+ labelledTextField= addLabelledTextField(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY, 4, 0, true);
+ fAutoInsertDelayLabel= getLabelControl(labelledTextField);
+ fAutoInsertDelayText= getTextControl(labelledTextField);
+
+ label= PreferencesMessages.getString("JavaEditorPreferencePage.autoActivationTriggersForJava"); //$NON-NLS-1$
+ labelledTextField= addLabelledTextField(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA, 4, 0, false);
+ fAutoInsertJavaTriggerLabel= getLabelControl(labelledTextField);
+ fAutoInsertJavaTriggerText= getTextControl(labelledTextField);
+
+ label= PreferencesMessages.getString("JavaEditorPreferencePage.autoActivationTriggersForJavaDoc"); //$NON-NLS-1$
+ labelledTextField= addLabelledTextField(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVADOC, 4, 0, false);
+ fAutoInsertJavaDocTriggerLabel= getLabelControl(labelledTextField);
+ fAutoInsertJavaDocTriggerText= getTextControl(labelledTextField);
+
+
+ Label l= new Label(contentAssistComposite, SWT.LEFT);
+ l.setText(PreferencesMessages.getString("JavaEditorPreferencePage.codeAssist.colorOptions")); //$NON-NLS-1$
+ GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ gd.horizontalSpan= 2;
+ l.setLayoutData(gd);
+
+ Composite editorComposite= new Composite(contentAssistComposite, SWT.NONE);
+ layout= new GridLayout();
+ layout.numColumns= 2;
+ layout.marginHeight= 0;
+ layout.marginWidth= 0;
+ editorComposite.setLayout(layout);
+ gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL);
+ gd.horizontalSpan= 2;
+ editorComposite.setLayoutData(gd);
+
+ fContentAssistColorList= new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER);
+ gd= new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
+ gd.heightHint= convertHeightInCharsToPixels(8);
+ fContentAssistColorList.setLayoutData(gd);
+
+ Composite stylesComposite= new Composite(editorComposite, SWT.NONE);
+ layout= new GridLayout();
+ layout.marginHeight= 0;
+ layout.marginWidth= 0;
+ layout.numColumns= 2;
+ stylesComposite.setLayout(layout);
+ stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ l= new Label(stylesComposite, SWT.LEFT);
+ l.setText(PreferencesMessages.getString("JavaEditorPreferencePage.codeAssist.color")); //$NON-NLS-1$
+ gd= new GridData();
+ gd.horizontalAlignment= GridData.BEGINNING;
+ l.setLayoutData(gd);
+
+ fContentAssistColorEditor= new ColorEditor(stylesComposite);
+ Button colorButton= fContentAssistColorEditor.getButton();
+ gd= new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalAlignment= GridData.BEGINNING;
+ colorButton.setLayoutData(gd);
+
+ fContentAssistColorList.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // do nothing
+ }
+ public void widgetSelected(SelectionEvent e) {
+ handleContentAssistColorListSelection();
+ }
+ });
+ colorButton.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // do nothing
+ }
+ public void widgetSelected(SelectionEvent e) {
+ int i= fContentAssistColorList.getSelectionIndex();
+ String key= fContentAssistColorListModel[i][1];
+
+ PreferenceConverter.setValue(fOverlayStore, key, fContentAssistColorEditor.getColorValue());
+ }
+ });
+
+ return contentAssistComposite;
+ }
+ private void addCompletionRadioButtons(Composite contentAssistComposite) {
+ Composite completionComposite= new Composite(contentAssistComposite, SWT.NONE);
+ GridData ccgd= new GridData();
+ ccgd.horizontalSpan= 2;
+ completionComposite.setLayoutData(ccgd);
+ GridLayout ccgl= new GridLayout();
+ ccgl.marginWidth= 0;
+ ccgl.numColumns= 2;
+ completionComposite.setLayout(ccgl);
+
+// SelectionListener completionSelectionListener= new SelectionAdapter() {
+// public void widgetSelected(SelectionEvent e) {
+// boolean insert= fCompletionInsertsRadioButton.getSelection();
+// fOverlayStore.setValue(PreferenceConstants.CODEASSIST_INSERT_COMPLETION, insert);
+// }
+// };
+//
+// fCompletionInsertsRadioButton= new Button(completionComposite, SWT.RADIO | SWT.LEFT);
+// fCompletionInsertsRadioButton.setText(PreferencesMessages.getString("JavaEditorPreferencePage.completionInserts")); //$NON-NLS-1$
+// fCompletionInsertsRadioButton.setLayoutData(new GridData());
+// fCompletionInsertsRadioButton.addSelectionListener(completionSelectionListener);
+//
+// fCompletionOverwritesRadioButton= new Button(completionComposite, SWT.RADIO | SWT.LEFT);
+// fCompletionOverwritesRadioButton.setText(PreferencesMessages.getString("JavaEditorPreferencePage.completionOverwrites")); //$NON-NLS-1$
+// fCompletionOverwritesRadioButton.setLayoutData(new GridData());
+// fCompletionOverwritesRadioButton.addSelectionListener(completionSelectionListener);
+ }
+
+ private Control createNavigationPage(Composite parent) {
+ Composite composite= new Composite(parent, SWT.NULL);
+ GridLayout layout= new GridLayout(); layout.numColumns= 2;
+ composite.setLayout(layout);
+
+// String text= PreferencesMessages.getString("JavaEditorPreferencePage.navigation.browserLikeLinks"); //$NON-NLS-1$
+// fBrowserLikeLinksCheckBox= addCheckBox(composite, text, PreferenceConstants.EDITOR_BROWSER_LIKE_LINKS, 0);
+// fBrowserLikeLinksCheckBox.addSelectionListener(new SelectionListener() {
+// public void widgetSelected(SelectionEvent e) {
+// boolean state= fBrowserLikeLinksCheckBox.getSelection();
+// fBrowserLikeLinksKeyModifierText.setEnabled(state);
+// handleBrowserLikeLinksKeyModifierModified();
+// }
+// public void widgetDefaultSelected(SelectionEvent e) {
+// }
+// });
+
+ // Text field for modifier string
+// text= PreferencesMessages.getString("JavaEditorPreferencePage.navigation.browserLikeLinksKeyModifier"); //$NON-NLS-1$
+// fBrowserLikeLinksKeyModifierText= addTextField(composite, text, PreferenceConstants.EDITOR_BROWSER_LIKE_LINKS_KEY_MODIFIER, 20, 0, false);
+// fBrowserLikeLinksKeyModifierText.setTextLimit(Text.LIMIT);
+//
+// if (computeStateMask(fOverlayStore.getString(PreferenceConstants.EDITOR_BROWSER_LIKE_LINKS_KEY_MODIFIER)) == -1) {
+// // Fix possible illegal modifier string
+// int stateMask= fOverlayStore.getInt(PreferenceConstants.EDITOR_BROWSER_LIKE_LINKS_KEY_MODIFIER_MASK);
+// if (stateMask == -1)
+// fBrowserLikeLinksKeyModifierText.setText(""); //$NON-NLS-1$
+// else
+// fBrowserLikeLinksKeyModifierText.setText(EditorUtility.getModifierString(stateMask));
+// }
+
+// fBrowserLikeLinksKeyModifierText.addKeyListener(new KeyListener() {
+// private boolean isModifierCandidate;
+// public void keyPressed(KeyEvent e) {
+// isModifierCandidate= e.keyCode > 0 && e.character == 0 && e.stateMask == 0;
+// }
+//
+// public void keyReleased(KeyEvent e) {
+// if (isModifierCandidate && e.stateMask > 0 && e.stateMask == e.stateMask && e.character == 0) {// && e.time -time < 1000) {
+// String modifierString= fBrowserLikeLinksKeyModifierText.getText();
+// Point selection= fBrowserLikeLinksKeyModifierText.getSelection();
+// int i= selection.x - 1;
+// while (i > -1 && Character.isWhitespace(modifierString.charAt(i))) {
+// i--;
+// }
+// boolean needsPrefixDelimiter= i > -1 && !String.valueOf(modifierString.charAt(i)).equals(DELIMITER);
+//
+// i= selection.y;
+// while (i < modifierString.length() && Character.isWhitespace(modifierString.charAt(i))) {
+// i++;
+// }
+// boolean needsPostfixDelimiter= i < modifierString.length() && !String.valueOf(modifierString.charAt(i)).equals(DELIMITER);
+//
+// String insertString;
+//
+// if (needsPrefixDelimiter && needsPostfixDelimiter)
+// insertString= PreferencesMessages.getFormattedString("JavaEditorPreferencePage.navigation.insertDelimiterAndModifierAndDelimiter", new String[] {Action.findModifierString(e.stateMask)}); //$NON-NLS-1$
+// else if (needsPrefixDelimiter)
+// insertString= PreferencesMessages.getFormattedString("JavaEditorPreferencePage.navigation.insertDelimiterAndModifier", new String[] {Action.findModifierString(e.stateMask)}); //$NON-NLS-1$
+// else if (needsPostfixDelimiter)
+// insertString= PreferencesMessages.getFormattedString("JavaEditorPreferencePage.navigation.insertModifierAndDelimiter", new String[] {Action.findModifierString(e.stateMask)}); //$NON-NLS-1$
+// else
+// insertString= Action.findModifierString(e.stateMask);
+//
+// fBrowserLikeLinksKeyModifierText.insert(insertString);
+// }
+// }
+// });
+//
+// fBrowserLikeLinksKeyModifierText.addModifyListener(new ModifyListener() {
+// public void modifyText(ModifyEvent e) {
+// handleBrowserLikeLinksKeyModifierModified();
+// }
+// });
+
+ return composite;
+ }
+
+ private void handleBrowserLikeLinksKeyModifierModified() {
+// String modifiers= fBrowserLikeLinksKeyModifierText.getText();
+// int stateMask= computeStateMask(modifiers);
+
+// if (fBrowserLikeLinksCheckBox.getSelection() && (stateMask == -1 || (stateMask & SWT.SHIFT) != 0)) {
+// if (stateMask == -1)
+// fBrowserLikeLinksKeyModifierStatus= new StatusInfo(IStatus.ERROR, PreferencesMessages.getFormattedString("JavaEditorPreferencePage.navigation.modifierIsNotValid", modifiers)); //$NON-NLS-1$
+// else
+// fBrowserLikeLinksKeyModifierStatus= new StatusInfo(IStatus.ERROR, PreferencesMessages.getString("JavaEditorPreferencePage.navigation.shiftIsDisabled")); //$NON-NLS-1$
+// setValid(false);
+// StatusUtil.applyToStatusLine(this, fBrowserLikeLinksKeyModifierStatus);
+// } else {
+// fBrowserLikeLinksKeyModifierStatus= new StatusInfo();
+// updateStatus(fBrowserLikeLinksKeyModifierStatus);
+// }
+ }
+
+// private IStatus getBrowserLikeLinksKeyModifierStatus() {
+// if (fBrowserLikeLinksKeyModifierStatus == null)
+// fBrowserLikeLinksKeyModifierStatus= new StatusInfo();
+// return fBrowserLikeLinksKeyModifierStatus;
+// }
+
+ /**
+ * Computes the state mask for the given modifier string.
+ *
+ * @param modifiers the string with the modifiers, separated by '+', '-', ';', ',' or '.'
+ * @return the state mask or -1 if the input is invalid
+ */
+ private int computeStateMask(String modifiers) {
+ if (modifiers == null)
+ return -1;
+
+ if (modifiers.length() == 0)
+ return SWT.NONE;
+
+ int stateMask= 0;
+ StringTokenizer modifierTokenizer= new StringTokenizer(modifiers, ",;.:+-* "); //$NON-NLS-1$
+ while (modifierTokenizer.hasMoreTokens()) {
+ int modifier= EditorUtility.findLocalizedModifier(modifierTokenizer.nextToken());
+ if (modifier == 0 || (stateMask & modifier) == modifier)
+ return -1;
+ stateMask= stateMask | modifier;
+ }
+ return stateMask;
+ }
+
+ /*
+ * @see PreferencePage#createContents(Composite)
+ */
+ protected Control createContents(Composite parent) {
+
+ initializeDefaultColors();
+
+ fOverlayStore.load();
+ fOverlayStore.start();
+
+ TabFolder folder= new TabFolder(parent, SWT.NONE);
+ folder.setLayout(new TabFolderLayout());
+ folder.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ TabItem item= new TabItem(folder, SWT.NONE);
+ item.setText(PreferencesMessages.getString("JavaEditorPreferencePage.general")); //$NON-NLS-1$
+ item.setControl(createAppearancePage(folder));
+
+ item= new TabItem(folder, SWT.NONE);
+ item.setText(PreferencesMessages.getString("JavaEditorPreferencePage.colors")); //$NON-NLS-1$
+ item.setControl(createSyntaxPage(folder));
+
+// item= new TabItem(folder, SWT.NONE);
+// item.setText(PreferencesMessages.getString("JavaEditorPreferencePage.codeAssist")); //$NON-NLS-1$
+// item.setControl(createContentAssistPage(folder));
+
+ item= new TabItem(folder, SWT.NONE);
+ item.setText(PreferencesMessages.getString("JavaEditorPreferencePage.annotationsTab.title")); //$NON-NLS-1$
+ item.setControl(createAnnotationsPage(folder));
+
+// item= new TabItem(folder, SWT.NONE);
+// item.setText(PreferencesMessages.getString("JavaEditorPreferencePage.typing.tabTitle")); //$NON-NLS-1$
+// item.setControl(createTypingPage(folder));
+//
+// item= new TabItem(folder, SWT.NONE);
+// item.setText(PreferencesMessages.getString("JavaEditorPreferencePage.hoverTab.title")); //$NON-NLS-1$
+// fJavaEditorHoverConfigurationBlock= new JavaEditorHoverConfigurationBlock(this, fOverlayStore);
+// item.setControl(fJavaEditorHoverConfigurationBlock.createControl(folder));
+
+// item= new TabItem(folder, SWT.NONE);
+// item.setText(PreferencesMessages.getString("JavaEditorPreferencePage.navigationTab.title")); //$NON-NLS-1$
+// item.setControl(createNavigationPage(folder));
+//
+ initialize();
+
+ Dialog.applyDialogFont(folder);
+ return folder;
+ }
+
+ private void initialize() {
+
+ initializeFields();
+
+ for (int i= 0; i < fSyntaxColorListModel.length; i++)
+ fSyntaxColorList.add(fSyntaxColorListModel[i][0]);
+ fSyntaxColorList.getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ if (fSyntaxColorList != null && !fSyntaxColorList.isDisposed()) {
+ fSyntaxColorList.select(0);
+ handleSyntaxColorListSelection();
+ }
+ }
+ });
+
+ for (int i= 0; i < fAppearanceColorListModel.length; i++)
+ fAppearanceColorList.add(fAppearanceColorListModel[i][0]);
+ fAppearanceColorList.getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ if (fAppearanceColorList != null && !fAppearanceColorList.isDisposed()) {
+ fAppearanceColorList.select(0);
+ handleAppearanceColorListSelection();
+ }
+ }
+ });
+
+ for (int i= 0; i < fAnnotationColorListModel.length; i++)
+ fAnnotationList.add(fAnnotationColorListModel[i][0]);
+ fAnnotationList.getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ if (fAnnotationList != null && !fAnnotationList.isDisposed()) {
+ fAnnotationList.select(0);
+ handleAnnotationListSelection();
+ }
+ }
+ });
+
+// for (int i= 0; i < fContentAssistColorListModel.length; i++)
+// fContentAssistColorList.add(fContentAssistColorListModel[i][0]);
+// fContentAssistColorList.getDisplay().asyncExec(new Runnable() {
+// public void run() {
+// if (fContentAssistColorList != null && !fContentAssistColorList.isDisposed()) {
+// fContentAssistColorList.select(0);
+// handleContentAssistColorListSelection();
+// }
+// }
+// });
+ }
+
+ private void initializeFields() {
+
+ Iterator e= fColorButtons.keySet().iterator();
+ while (e.hasNext()) {
+ ColorEditor c= (ColorEditor) e.next();
+ String key= (String) fColorButtons.get(c);
+ RGB rgb= PreferenceConverter.getColor(fOverlayStore, key);
+ c.setColorValue(rgb);
+ }
+
+ e= fCheckBoxes.keySet().iterator();
+ while (e.hasNext()) {
+ Button b= (Button) e.next();
+ String key= (String) fCheckBoxes.get(b);
+ b.setSelection(fOverlayStore.getBoolean(key));
+ }
+
+ e= fTextFields.keySet().iterator();
+ while (e.hasNext()) {
+ Text t= (Text) e.next();
+ String key= (String) fTextFields.get(t);
+ t.setText(fOverlayStore.getString(key));
+ }
+
+ RGB rgb= PreferenceConverter.getColor(fOverlayStore, PreferenceConstants.EDITOR_BACKGROUND_COLOR);
+ fBackgroundColorEditor.setColorValue(rgb);
+
+ boolean default_= fOverlayStore.getBoolean(PreferenceConstants.EDITOR_BACKGROUND_DEFAULT_COLOR);
+ fBackgroundDefaultRadioButton.setSelection(default_);
+ fBackgroundCustomRadioButton.setSelection(!default_);
+ fBackgroundColorButton.setEnabled(!default_);
+
+// boolean closeJavaDocs= fOverlayStore.getBoolean(PreferenceConstants.EDITOR_CLOSE_JAVADOCS);
+// fAddJavaDocTagsButton.setEnabled(closeJavaDocs);
+
+// fEscapeStringsButton.setEnabled(fOverlayStore.getBoolean(PreferenceConstants.EDITOR_WRAP_STRINGS));
+
+// boolean fillMethodArguments= fOverlayStore.getBoolean(PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES);
+// fGuessMethodArgumentsButton.setEnabled(fillMethodArguments);
+
+// boolean completionInserts= fOverlayStore.getBoolean(PreferenceConstants.CODEASSIST_INSERT_COMPLETION);
+// fCompletionInsertsRadioButton.setSelection(completionInserts);
+// fCompletionOverwritesRadioButton.setSelection(! completionInserts);
+//
+// fBrowserLikeLinksKeyModifierText.setEnabled(fBrowserLikeLinksCheckBox.getSelection());
+
+// boolean markOccurrences= fOverlayStore.getBoolean(PreferenceConstants.EDITOR_MARK_OCCURRENCES);
+// fStickyOccurrencesButton.setEnabled(markOccurrences);
+
+ updateAutoactivationControls();
+ }
+
+ private void initializeDefaultColors() {
+ if (!getPreferenceStore().contains(PreferenceConstants.EDITOR_BACKGROUND_COLOR)) {
+ RGB rgb= getControl().getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB();
+ PreferenceConverter.setDefault(fOverlayStore, PreferenceConstants.EDITOR_BACKGROUND_COLOR, rgb);
+ PreferenceConverter.setDefault(getPreferenceStore(), PreferenceConstants.EDITOR_BACKGROUND_COLOR, rgb);
+ }
+ if (!getPreferenceStore().contains(PreferenceConstants.EDITOR_FOREGROUND_COLOR)) {
+ RGB rgb= getControl().getDisplay().getSystemColor(SWT.COLOR_LIST_FOREGROUND).getRGB();
+ PreferenceConverter.setDefault(fOverlayStore, PreferenceConstants.EDITOR_FOREGROUND_COLOR, rgb);
+ PreferenceConverter.setDefault(getPreferenceStore(), PreferenceConstants.EDITOR_FOREGROUND_COLOR, rgb);
+ }
+ }
+
+ private void updateAutoactivationControls() {
+// boolean autoactivation= fOverlayStore.getBoolean(PreferenceConstants.CODEASSIST_AUTOACTIVATION);
+// fAutoInsertDelayText.setEnabled(autoactivation);
+// fAutoInsertDelayLabel.setEnabled(autoactivation);
+
+// fAutoInsertJavaTriggerText.setEnabled(autoactivation);
+// fAutoInsertJavaTriggerLabel.setEnabled(autoactivation);
+//
+// fAutoInsertJavaDocTriggerText.setEnabled(autoactivation);
+// fAutoInsertJavaDocTriggerLabel.setEnabled(autoactivation);
+ }
+
+ /*
+ * @see PreferencePage#performOk()
+ */
+ public boolean performOk() {
+// fJavaEditorHoverConfigurationBlock.performOk();
+// fOverlayStore.setValue(PreferenceConstants.EDITOR_BROWSER_LIKE_LINKS_KEY_MODIFIER_MASK, computeStateMask(fBrowserLikeLinksKeyModifierText.getText()));
+ fOverlayStore.propagate();
+ PHPeclipsePlugin.getDefault().savePluginPreferences();
+ return true;
+ }
+
+ /*
+ * @see PreferencePage#performDefaults()
+ */
+ protected void performDefaults() {
+
+ fOverlayStore.loadDefaults();
+
+ initializeFields();
+
+ handleSyntaxColorListSelection();
+ handleAppearanceColorListSelection();
+ handleAnnotationListSelection();
+// handleContentAssistColorListSelection();
+
+// fJavaEditorHoverConfigurationBlock.performDefaults();
+
+ super.performDefaults();
+
+ fPreviewViewer.invalidateTextPresentation();
+ }
+
+ /*
+ * @see DialogPage#dispose()
+ */
+ public void dispose() {
+
+ if (fJavaTextTools != null) {
+ fJavaTextTools.dispose();
+ fJavaTextTools= null;
+ }
+
+ if (fOverlayStore != null) {
+ fOverlayStore.stop();
+ fOverlayStore= null;
+ }
+ if (fBackgroundColor != null && !fBackgroundColor.isDisposed())
+ fBackgroundColor.dispose();
+
+ super.dispose();
+ }
+
+ private Button addCheckBox(Composite parent, String label, String key, int indentation) {
+ Button checkBox= new Button(parent, SWT.CHECK);
+ checkBox.setText(label);
+
+ GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
+ gd.horizontalIndent= indentation;
+ gd.horizontalSpan= 2;
+ checkBox.setLayoutData(gd);
+ checkBox.addSelectionListener(fCheckBoxListener);
+
+ fCheckBoxes.put(checkBox, key);
+
+ return checkBox;
+ }
+
+ private Text addTextField(Composite composite, String label, String key, int textLimit, int indentation, boolean isNumber) {
+ return getTextControl(addLabelledTextField(composite, label, key, textLimit, indentation, isNumber));
+ }
+
+ private static Label getLabelControl(Control[] labelledTextField){
+ return (Label)labelledTextField[0];
+ }
+
+ private static Text getTextControl(Control[] labelledTextField){
+ return (Text)labelledTextField[1];
+ }
+
+ /**
+ * Returns an array of size 2:
+ * - first element is of type <code>Label</code>
+ * - second element is of type <code>Text</code>
+ * Use <code>getLabelControl</code> and <code>getTextControl</code> to get the 2 controls.
+ */
+ private Control[] addLabelledTextField(Composite composite, String label, String key, int textLimit, int indentation, boolean isNumber) {
+ Label labelControl= new Label(composite, SWT.NONE);
+ labelControl.setText(label);
+ GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
+ gd.horizontalIndent= indentation;
+ labelControl.setLayoutData(gd);
+
+ Text textControl= new Text(composite, SWT.BORDER | SWT.SINGLE);
+ gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
+ gd.widthHint= convertWidthInCharsToPixels(textLimit + 1);
+ textControl.setLayoutData(gd);
+ textControl.setTextLimit(textLimit);
+ fTextFields.put(textControl, key);
+ if (isNumber) {
+ fNumberFields.add(textControl);
+ textControl.addModifyListener(fNumberFieldListener);
+ } else {
+ textControl.addModifyListener(fTextFieldListener);
+ }
+
+ return new Control[]{labelControl, textControl};
+ }
+
+ private String loadPreviewContentFromFile(String filename) {
+ String line;
+ String separator= System.getProperty("line.separator"); //$NON-NLS-1$
+ StringBuffer buffer= new StringBuffer(512);
+ BufferedReader reader= null;
+ try {
+ reader= new BufferedReader(new InputStreamReader(getClass().getResourceAsStream(filename)));
+ while ((line= reader.readLine()) != null) {
+ buffer.append(line);
+ buffer.append(separator);
+ }
+ } catch (IOException io) {
+ PHPeclipsePlugin.log(io);
+ } finally {
+ if (reader != null) {
+ try { reader.close(); } catch (IOException e) {}
+ }
+ }
+ return buffer.toString();
+ }
+
+ private void numberFieldChanged(Text textControl) {
+ String number= textControl.getText();
+ IStatus status= validatePositiveNumber(number);
+ if (!status.matches(IStatus.ERROR))
+ fOverlayStore.setValue((String) fTextFields.get(textControl), number);
+ updateStatus(status);
+ }
+
+ private IStatus validatePositiveNumber(String number) {
+ StatusInfo status= new StatusInfo();
+ if (number.length() == 0) {
+ status.setError(PreferencesMessages.getString("JavaEditorPreferencePage.empty_input")); //$NON-NLS-1$
+ } else {
+ try {
+ int value= Integer.parseInt(number);
+ if (value < 0)
+ status.setError(PreferencesMessages.getFormattedString("JavaEditorPreferencePage.invalid_input", number)); //$NON-NLS-1$
+ } catch (NumberFormatException e) {
+ status.setError(PreferencesMessages.getFormattedString("JavaEditorPreferencePage.invalid_input", number)); //$NON-NLS-1$
+ }
+ }
+ return status;
+ }
+
+ void updateStatus(IStatus status) {
+ if (!status.matches(IStatus.ERROR)) {
+ for (int i= 0; i < fNumberFields.size(); i++) {
+ Text text= (Text) fNumberFields.get(i);
+ IStatus s= validatePositiveNumber(text.getText());
+ status= StatusUtil.getMoreSevere(s, status);
+ }
+ }
+// status= StatusUtil.getMoreSevere(fJavaEditorHoverConfigurationBlock.getStatus(), status);
+// status= StatusUtil.getMoreSevere(getBrowserLikeLinksKeyModifierStatus(), status);
+ setValid(!status.matches(IStatus.ERROR));
+ StatusUtil.applyToStatusLine(this, status);
+ }
+}
/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
-**********************************************************************/
-
+ Copyright (c) 2000, 2002 IBM Corp. and others.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Common Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/cpl-v10.html
+
+ Contributors:
+ IBM Corporation - Initial implementation
+ **********************************************************************/
package net.sourceforge.phpdt.internal.ui.preferences;
-
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
+import java.text.Collator;
import java.util.ArrayList;
+import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
-
+import java.util.SortedSet;
+import java.util.TreeSet;
import net.sourceforge.phpdt.core.JavaCore;
import net.sourceforge.phpdt.internal.ui.PHPUIMessages;
-import net.sourceforge.phpdt.internal.ui.dialog.StatusInfo;
-import net.sourceforge.phpdt.internal.ui.dialog.StatusUtil;
+import net.sourceforge.phpdt.internal.ui.dialogs.StatusInfo;
+import net.sourceforge.phpdt.internal.ui.dialogs.StatusUtil;
import net.sourceforge.phpdt.internal.ui.util.TabFolderLayout;
import net.sourceforge.phpdt.ui.PreferenceConstants;
import net.sourceforge.phpdt.ui.text.JavaTextTools;
import net.sourceforge.phpeclipse.PHPeclipsePlugin;
import net.sourceforge.phpeclipse.phpeditor.PHPSourceViewerConfiguration;
import net.sourceforge.phpeclipse.preferences.ColorEditor;
-
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Preferences;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.ui.texteditor.AnnotationPreference;
+import org.eclipse.ui.texteditor.MarkerAnnotationPreferences;
import org.eclipse.ui.texteditor.WorkbenchChainedTextFontFieldEditor;
-
/*
* The page for setting the editor options.
*/
-public class PHPEditorPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
-
+public class PHPEditorPreferencePage extends PreferencePage
+ implements
+ IWorkbenchPreferencePage {
private static final String BOLD = PreferenceConstants.EDITOR_BOLD_SUFFIX;
private static final String COMPILER_TASK_TAGS = JavaCore.COMPILER_TASK_TAGS;
-
- public final OverlayPreferenceStore.OverlayKey[] fKeys =
- new OverlayPreferenceStore.OverlayKey[] {
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_FOREGROUND_COLOR),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_FOREGROUND_DEFAULT_COLOR),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_BACKGROUND_COLOR),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_BACKGROUND_DEFAULT_COLOR),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT, PreferenceConstants.EDITOR_TAB_WIDTH),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_COLOR),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_BOLD),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_COLOR),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_BOLD),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVA_TAG_COLOR),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVA_TAG_BOLD),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVA_KEYWORD_COLOR),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVA_KEYWORD_BOLD),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_PHP_FUNCTIONNAME_COLOR),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_PHP_FUNCTIONNAME_BOLD),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_PHP_VARIABLE_COLOR),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_PHP_VARIABLE_BOLD),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_PHP_CONSTANT_COLOR),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_PHP_CONSTANT_BOLD),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_PHP_TYPE_COLOR),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_PHP_TYPE_BOLD),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_STRING_COLOR),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_STRING_BOLD),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVA_DEFAULT_COLOR),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVA_DEFAULT_BOLD),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVADOC_KEYWORD_COLOR),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVADOC_KEYWORD_BOLD),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVADOC_TAG_COLOR),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVADOC_TAG_BOLD),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVADOC_LINKS_COLOR),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVADOC_LINKS_BOLD),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVADOC_DEFAULT_COLOR),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVADOC_DEFAULT_BOLD),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_MATCHING_BRACKETS),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_CURRENT_LINE_COLOR),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CURRENT_LINE),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_PRINT_MARGIN_COLOR),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT, PreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_PRINT_MARGIN),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_FIND_SCOPE_COLOR),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_LINKED_POSITION_COLOR),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_LINK_COLOR),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_PROBLEM_INDICATION_COLOR),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_PROBLEM_INDICATION),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_WARNING_INDICATION_COLOR),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_WARNING_INDICATION),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_TASK_INDICATION_COLOR),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_TASK_INDICATION),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_BOOKMARK_INDICATION_COLOR),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_BOOKMARK_INDICATION),
- new OverlayPreferenceStore.OverlayKey(
- OverlayPreferenceStore.STRING,
- PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION_COLOR),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_UNKNOWN_INDICATION_COLOR),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_UNKNOWN_INDICATION),
- new OverlayPreferenceStore.OverlayKey(
- OverlayPreferenceStore.BOOLEAN,
- PreferenceConstants.EDITOR_ERROR_INDICATION_IN_OVERVIEW_RULER),
- new OverlayPreferenceStore.OverlayKey(
- OverlayPreferenceStore.BOOLEAN,
- PreferenceConstants.EDITOR_WARNING_INDICATION_IN_OVERVIEW_RULER),
- new OverlayPreferenceStore.OverlayKey(
- OverlayPreferenceStore.BOOLEAN,
- PreferenceConstants.EDITOR_TASK_INDICATION_IN_OVERVIEW_RULER),
- new OverlayPreferenceStore.OverlayKey(
- OverlayPreferenceStore.BOOLEAN,
- PreferenceConstants.EDITOR_BOOKMARK_INDICATION_IN_OVERVIEW_RULER),
- new OverlayPreferenceStore.OverlayKey(
- OverlayPreferenceStore.BOOLEAN,
- PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION_IN_OVERVIEW_RULER),
- new OverlayPreferenceStore.OverlayKey(
- OverlayPreferenceStore.BOOLEAN,
- PreferenceConstants.EDITOR_UNKNOWN_INDICATION_IN_OVERVIEW_RULER),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CORRECTION_INDICATION),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_EVALUTE_TEMPORARY_PROBLEMS),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_OVERVIEW_RULER),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_LINE_NUMBER_RULER),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SPACES_FOR_TABS),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_AUTOACTIVATION),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT, PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_AUTOINSERT),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_PROPOSALS_BACKGROUND),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_PROPOSALS_FOREGROUND),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_PARAMETERS_BACKGROUND),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_PARAMETERS_FOREGROUND),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_REPLACEMENT_BACKGROUND),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_REPLACEMENT_FOREGROUND),
- new OverlayPreferenceStore.OverlayKey(
- OverlayPreferenceStore.STRING,
- PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA),
- new OverlayPreferenceStore.OverlayKey(
- OverlayPreferenceStore.STRING,
- PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVADOC),
- new OverlayPreferenceStore.OverlayKey(
- OverlayPreferenceStore.STRING,
- PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_HTML),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_SHOW_VISIBLE_PROPOSALS),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_ORDER_PROPOSALS),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_CASE_SENSITIVITY),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_ADDIMPORT),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_INSERT_COMPLETION),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_GUESS_METHOD_ARGUMENTS),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SMART_PASTE),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CLOSE_STRINGS_PHP),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CLOSE_BRACKETS_PHP),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CLOSE_BRACES),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CLOSE_JAVADOCS),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_WRAP_STRINGS),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_ADD_JAVADOC_TAGS),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_FORMAT_JAVADOCS),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SMART_HOME_END),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CLOSE_STRINGS_HTML),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CLOSE_BRACKETS_HTML),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_DEFAULT_HOVER),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_NONE_HOVER),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_CTRL_HOVER),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_SHIFT_HOVER),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_CTRL_SHIFT_HOVER),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_CTRL_ALT_HOVER),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_CTRL_ALT_SHIFT_HOVER),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_CTRL_SHIFT_HOVER),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_ALT_SHIFT_HOVER),
- new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, IPreferenceConstants.PHP_USERDEF_XMLFILE),
- };
-
- private final String[][] fSyntaxColorListModel = new String[][] { { PHPUIMessages.getString("PHPEditorPreferencePage.multiLineComment"), PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_COLOR }, //$NON-NLS-1$
- {
- PHPUIMessages.getString("PHPEditorPreferencePage.singleLineComment"), PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_COLOR }, //$NON-NLS-1$
- {
- PHPUIMessages.getString("PHPEditorPreferencePage.tags"), PreferenceConstants.EDITOR_JAVA_TAG_COLOR }, //$NON-NLS-1$
- {
- PHPUIMessages.getString("PHPEditorPreferencePage.keywords"), PreferenceConstants.EDITOR_JAVA_KEYWORD_COLOR }, //$NON-NLS-1$
- {
- PHPUIMessages.getString("PHPEditorPreferencePage.functionNames"), PreferenceConstants.EDITOR_PHP_FUNCTIONNAME_COLOR }, //$NON-NLS-1$
- {
- PHPUIMessages.getString("PHPEditorPreferencePage.variables"), PreferenceConstants.EDITOR_PHP_VARIABLE_COLOR }, //$NON-NLS-1$
- {
- PHPUIMessages.getString("PHPEditorPreferencePage.constants"), PreferenceConstants.EDITOR_PHP_CONSTANT_COLOR }, //$NON-NLS-1$
- {
- PHPUIMessages.getString("PHPEditorPreferencePage.types"), PreferenceConstants.EDITOR_PHP_TYPE_COLOR }, //$NON-NLS-1$
- {
- PHPUIMessages.getString("PHPEditorPreferencePage.strings"), PreferenceConstants.EDITOR_STRING_COLOR }, //$NON-NLS-1$
- {
- PHPUIMessages.getString("PHPEditorPreferencePage.others"), PreferenceConstants.EDITOR_JAVA_DEFAULT_COLOR }, //$NON-NLS-1$
- {
- PHPUIMessages.getString("PHPEditorPreferencePage.phpDocKeywords"), PreferenceConstants.EDITOR_JAVADOC_KEYWORD_COLOR }, //$NON-NLS-1$
- {
- PHPUIMessages.getString("PHPEditorPreferencePage.phpDocHtmlTags"), PreferenceConstants.EDITOR_JAVADOC_TAG_COLOR }, //$NON-NLS-1$
- {
- PHPUIMessages.getString("PHPEditorPreferencePage.phpDocLinks"), PreferenceConstants.EDITOR_JAVADOC_LINKS_COLOR }, //$NON-NLS-1$
- {
- PHPUIMessages.getString("PHPEditorPreferencePage.phpDocOthers"), PreferenceConstants.EDITOR_JAVADOC_DEFAULT_COLOR } //$NON-NLS-1$
+ // public final OverlayPreferenceStore.OverlayKey[] fKeys =
+ // new OverlayPreferenceStore.OverlayKey[] {
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.EDITOR_FOREGROUND_COLOR),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_FOREGROUND_DEFAULT_COLOR),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.EDITOR_BACKGROUND_COLOR),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_BACKGROUND_DEFAULT_COLOR),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT,
+ // PreferenceConstants.EDITOR_TAB_WIDTH),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_COLOR),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_BOLD),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_COLOR),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_BOLD),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.EDITOR_JAVA_TAG_COLOR),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_JAVA_TAG_BOLD),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.EDITOR_JAVA_KEYWORD_COLOR),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_JAVA_KEYWORD_BOLD),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.EDITOR_PHP_FUNCTIONNAME_COLOR),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_PHP_FUNCTIONNAME_BOLD),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.EDITOR_PHP_VARIABLE_COLOR),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_PHP_VARIABLE_BOLD),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.EDITOR_PHP_CONSTANT_COLOR),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_PHP_CONSTANT_BOLD),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.EDITOR_PHP_TYPE_COLOR),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_PHP_TYPE_BOLD),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.EDITOR_STRING_COLOR),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_STRING_BOLD),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.EDITOR_JAVA_DEFAULT_COLOR),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_JAVA_DEFAULT_BOLD),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.EDITOR_JAVADOC_KEYWORD_COLOR),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_JAVADOC_KEYWORD_BOLD),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.EDITOR_JAVADOC_TAG_COLOR),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_JAVADOC_TAG_BOLD),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.EDITOR_JAVADOC_LINKS_COLOR),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_JAVADOC_LINKS_BOLD),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.EDITOR_JAVADOC_DEFAULT_COLOR),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_JAVADOC_DEFAULT_BOLD),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_MATCHING_BRACKETS),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.EDITOR_CURRENT_LINE_COLOR),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_CURRENT_LINE),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.EDITOR_PRINT_MARGIN_COLOR),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT,
+ // PreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_PRINT_MARGIN),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.EDITOR_FIND_SCOPE_COLOR),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.EDITOR_LINKED_POSITION_COLOR),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.EDITOR_LINK_COLOR),
+ //// new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.EDITOR_PROBLEM_INDICATION_COLOR),
+ //// new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_PROBLEM_INDICATION),
+ //// new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.EDITOR_WARNING_INDICATION_COLOR),
+ //// new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_WARNING_INDICATION),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.EDITOR_TASK_INDICATION_COLOR),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_TASK_INDICATION),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.EDITOR_BOOKMARK_INDICATION_COLOR),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_BOOKMARK_INDICATION),
+ // new OverlayPreferenceStore.OverlayKey(
+ // OverlayPreferenceStore.STRING,
+ // PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION_COLOR),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.EDITOR_UNKNOWN_INDICATION_COLOR),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_UNKNOWN_INDICATION),
+ // new OverlayPreferenceStore.OverlayKey(
+ // OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_ERROR_INDICATION_IN_OVERVIEW_RULER),
+ // new OverlayPreferenceStore.OverlayKey(
+ // OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_WARNING_INDICATION_IN_OVERVIEW_RULER),
+ // new OverlayPreferenceStore.OverlayKey(
+ // OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_TASK_INDICATION_IN_OVERVIEW_RULER),
+ // new OverlayPreferenceStore.OverlayKey(
+ // OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_BOOKMARK_INDICATION_IN_OVERVIEW_RULER),
+ // new OverlayPreferenceStore.OverlayKey(
+ // OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION_IN_OVERVIEW_RULER),
+ // new OverlayPreferenceStore.OverlayKey(
+ // OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_UNKNOWN_INDICATION_IN_OVERVIEW_RULER),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_CORRECTION_INDICATION),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_EVALUTE_TEMPORARY_PROBLEMS),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_OVERVIEW_RULER),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_LINE_NUMBER_RULER),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_SPACES_FOR_TABS),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.CODEASSIST_AUTOACTIVATION),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT,
+ // PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.CODEASSIST_AUTOINSERT),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.CODEASSIST_PROPOSALS_BACKGROUND),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.CODEASSIST_PROPOSALS_FOREGROUND),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.CODEASSIST_PARAMETERS_BACKGROUND),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.CODEASSIST_PARAMETERS_FOREGROUND),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.CODEASSIST_REPLACEMENT_BACKGROUND),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.CODEASSIST_REPLACEMENT_FOREGROUND),
+ // new OverlayPreferenceStore.OverlayKey(
+ // OverlayPreferenceStore.STRING,
+ // PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA),
+ // new OverlayPreferenceStore.OverlayKey(
+ // OverlayPreferenceStore.STRING,
+ // PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVADOC),
+ // new OverlayPreferenceStore.OverlayKey(
+ // OverlayPreferenceStore.STRING,
+ // PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_HTML),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.CODEASSIST_SHOW_VISIBLE_PROPOSALS),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.CODEASSIST_ORDER_PROPOSALS),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.CODEASSIST_CASE_SENSITIVITY),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.CODEASSIST_ADDIMPORT),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.CODEASSIST_INSERT_COMPLETION),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.CODEASSIST_GUESS_METHOD_ARGUMENTS),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_SMART_PASTE),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // IPreferenceConstants.PHP_USERDEF_XMLFILE),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_CLOSE_STRINGS_PHP),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_CLOSE_BRACKETS_PHP),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_CLOSE_BRACES),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_CLOSE_JAVADOCS),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_WRAP_STRINGS),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_ADD_JAVADOC_TAGS),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_FORMAT_JAVADOCS),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_SMART_HOME_END),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_CLOSE_STRINGS_HTML),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_CLOSE_BRACKETS_HTML),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.EDITOR_DEFAULT_HOVER),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.EDITOR_NONE_HOVER),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.EDITOR_CTRL_HOVER),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.EDITOR_SHIFT_HOVER),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.EDITOR_CTRL_SHIFT_HOVER),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.EDITOR_CTRL_ALT_HOVER),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.EDITOR_CTRL_ALT_SHIFT_HOVER),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.EDITOR_CTRL_SHIFT_HOVER),
+ // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.EDITOR_ALT_SHIFT_HOVER),
+ // };
+ /** The keys of the overlay store. */
+ public final OverlayPreferenceStore.OverlayKey[] fKeys;
+ private final String[][] fSyntaxColorListModel = new String[][]{
+ {PHPUIMessages.getString("PHPEditorPreferencePage.multiLineComment"),
+ PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_COLOR},
+ //$NON-NLS-1$
+ {PHPUIMessages.getString("PHPEditorPreferencePage.singleLineComment"),
+ PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_COLOR},
+ //$NON-NLS-1$
+ {PHPUIMessages.getString("PHPEditorPreferencePage.tags"),
+ PreferenceConstants.EDITOR_JAVA_TAG_COLOR},
+ //$NON-NLS-1$
+ {PHPUIMessages.getString("PHPEditorPreferencePage.keywords"),
+ PreferenceConstants.EDITOR_JAVA_KEYWORD_COLOR},
+ //$NON-NLS-1$
+ {PHPUIMessages.getString("PHPEditorPreferencePage.functionNames"),
+ PreferenceConstants.EDITOR_PHP_FUNCTIONNAME_COLOR},
+ //$NON-NLS-1$
+ {PHPUIMessages.getString("PHPEditorPreferencePage.variables"),
+ PreferenceConstants.EDITOR_PHP_VARIABLE_COLOR},
+ //$NON-NLS-1$
+ {PHPUIMessages.getString("PHPEditorPreferencePage.constants"),
+ PreferenceConstants.EDITOR_PHP_CONSTANT_COLOR},
+ //$NON-NLS-1$
+ {PHPUIMessages.getString("PHPEditorPreferencePage.types"),
+ PreferenceConstants.EDITOR_PHP_TYPE_COLOR},
+ //$NON-NLS-1$
+ {PHPUIMessages.getString("PHPEditorPreferencePage.strings"),
+ PreferenceConstants.EDITOR_STRING_COLOR},
+ //$NON-NLS-1$
+ {PHPUIMessages.getString("PHPEditorPreferencePage.others"),
+ PreferenceConstants.EDITOR_JAVA_DEFAULT_COLOR},
+ //$NON-NLS-1$
+ {PHPUIMessages.getString("PHPEditorPreferencePage.phpDocKeywords"),
+ PreferenceConstants.EDITOR_JAVADOC_KEYWORD_COLOR},
+ //$NON-NLS-1$
+ {PHPUIMessages.getString("PHPEditorPreferencePage.phpDocHtmlTags"),
+ PreferenceConstants.EDITOR_JAVADOC_TAG_COLOR},
+ //$NON-NLS-1$
+ {PHPUIMessages.getString("PHPEditorPreferencePage.phpDocLinks"),
+ PreferenceConstants.EDITOR_JAVADOC_LINKS_COLOR},
+ //$NON-NLS-1$
+ {PHPUIMessages.getString("PHPEditorPreferencePage.phpDocOthers"),
+ PreferenceConstants.EDITOR_JAVADOC_DEFAULT_COLOR} //$NON-NLS-1$
};
-
- private final String[][] fAppearanceColorListModel = new String[][] { { PHPUIMessages.getString("PHPEditorPreferencePage.lineNumberForegroundColor"), PreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR }, //$NON-NLS-1$
- {
- PHPUIMessages.getString("PHPEditorPreferencePage.matchingBracketsHighlightColor2"), PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR }, //$NON-NLS-1$
- {
- PHPUIMessages.getString("PHPEditorPreferencePage.currentLineHighlighColor"), PreferenceConstants.EDITOR_CURRENT_LINE_COLOR }, //$NON-NLS-1$
- {
- PHPUIMessages.getString("PHPEditorPreferencePage.printMarginColor2"), PreferenceConstants.EDITOR_PRINT_MARGIN_COLOR }, //$NON-NLS-1$
- {
- PHPUIMessages.getString("PHPEditorPreferencePage.findScopeColor2"), PreferenceConstants.EDITOR_FIND_SCOPE_COLOR }, //$NON-NLS-1$
- {
- PHPUIMessages.getString("PHPEditorPreferencePage.linkedPositionColor2"), PreferenceConstants.EDITOR_LINKED_POSITION_COLOR }, //$NON-NLS-1$
- {
- PHPUIMessages.getString("PHPEditorPreferencePage.linkColor2"), PreferenceConstants.EDITOR_LINK_COLOR }, //$NON-NLS-1$
+ private final String[][] fAppearanceColorListModel = new String[][]{
+ {
+ PHPUIMessages
+ .getString("PHPEditorPreferencePage.lineNumberForegroundColor"),
+ PreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR},
+ //$NON-NLS-1$
+ {
+ PHPUIMessages
+ .getString("PHPEditorPreferencePage.matchingBracketsHighlightColor2"),
+ PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR},
+ //$NON-NLS-1$
+ {
+ PHPUIMessages
+ .getString("PHPEditorPreferencePage.currentLineHighlighColor"),
+ PreferenceConstants.EDITOR_CURRENT_LINE_COLOR},
+ //$NON-NLS-1$
+ {PHPUIMessages.getString("PHPEditorPreferencePage.printMarginColor2"),
+ PreferenceConstants.EDITOR_PRINT_MARGIN_COLOR},
+ //$NON-NLS-1$
+ {PHPUIMessages.getString("PHPEditorPreferencePage.findScopeColor2"),
+ PreferenceConstants.EDITOR_FIND_SCOPE_COLOR},
+ //$NON-NLS-1$
+ {PHPUIMessages.getString("PHPEditorPreferencePage.linkedPositionColor2"),
+ PreferenceConstants.EDITOR_LINKED_POSITION_COLOR},
+ //$NON-NLS-1$
+ {PHPUIMessages.getString("PHPEditorPreferencePage.linkColor2"),
+ PreferenceConstants.EDITOR_LINK_COLOR}, //$NON-NLS-1$
};
-
- private final String[][] fProblemIndicationColorListModel =
- new String[][] {
+ // private final String[][] fProblemIndicationColorListModel =
+ // new String[][] {
+ // {
+ // "Errors",
+ // PreferenceConstants.EDITOR_PROBLEM_INDICATION_COLOR,
+ // PreferenceConstants.EDITOR_PROBLEM_INDICATION,
+ // PreferenceConstants.EDITOR_ERROR_INDICATION_IN_OVERVIEW_RULER },
+ // {
+ // "Warnings",
+ // PreferenceConstants.EDITOR_WARNING_INDICATION_COLOR,
+ // PreferenceConstants.EDITOR_WARNING_INDICATION,
+ // PreferenceConstants.EDITOR_WARNING_INDICATION_IN_OVERVIEW_RULER },
+ // {
+ // "Tasks",
+ // PreferenceConstants.EDITOR_TASK_INDICATION_COLOR,
+ // PreferenceConstants.EDITOR_TASK_INDICATION,
+ // PreferenceConstants.EDITOR_TASK_INDICATION_IN_OVERVIEW_RULER },
+ // {
+ // "Search Results",
+ // PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION_COLOR,
+ // PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION,
+ // PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION_IN_OVERVIEW_RULER },
+ // {
+ // "Bookmarks",
+ // PreferenceConstants.EDITOR_BOOKMARK_INDICATION_COLOR,
+ // PreferenceConstants.EDITOR_BOOKMARK_INDICATION,
+ // PreferenceConstants.EDITOR_BOOKMARK_INDICATION_IN_OVERVIEW_RULER },
+ // {
+ // "Others",
+ // PreferenceConstants.EDITOR_UNKNOWN_INDICATION_COLOR,
+ // PreferenceConstants.EDITOR_UNKNOWN_INDICATION,
+ // PreferenceConstants.EDITOR_UNKNOWN_INDICATION_IN_OVERVIEW_RULER }
+ // };
+ private final String[][] fAnnotationColorListModel;
+ private final String[][] fAnnotationDecorationListModel = new String[][]{
+ {
+ PreferencesMessages
+ .getString("JavaEditorPreferencePage.AnnotationDecoration.NONE"),
+ AnnotationPreference.STYLE_NONE},
+ //$NON-NLS-1$
+ {
+ PreferencesMessages
+ .getString("JavaEditorPreferencePage.AnnotationDecoration.SQUIGGLIES"),
+ AnnotationPreference.STYLE_SQUIGGLIES},
+ //$NON-NLS-1$
+ {
+ PreferencesMessages
+ .getString("JavaEditorPreferencePage.AnnotationDecoration.UNDERLINE"),
+ AnnotationPreference.STYLE_UNDERLINE},
+ //$NON-NLS-1$
{
- "Errors",
- PreferenceConstants.EDITOR_PROBLEM_INDICATION_COLOR,
- PreferenceConstants.EDITOR_PROBLEM_INDICATION,
- PreferenceConstants.EDITOR_ERROR_INDICATION_IN_OVERVIEW_RULER },
+ PreferencesMessages
+ .getString("JavaEditorPreferencePage.AnnotationDecoration.BOX"),
+ AnnotationPreference.STYLE_BOX},
+ //$NON-NLS-1$
{
- "Warnings",
- PreferenceConstants.EDITOR_WARNING_INDICATION_COLOR,
- PreferenceConstants.EDITOR_WARNING_INDICATION,
- PreferenceConstants.EDITOR_WARNING_INDICATION_IN_OVERVIEW_RULER },
- {
- "Tasks",
- PreferenceConstants.EDITOR_TASK_INDICATION_COLOR,
- PreferenceConstants.EDITOR_TASK_INDICATION,
- PreferenceConstants.EDITOR_TASK_INDICATION_IN_OVERVIEW_RULER },
- {
- "Search Results",
- PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION_COLOR,
- PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION,
- PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION_IN_OVERVIEW_RULER },
- {
- "Bookmarks",
- PreferenceConstants.EDITOR_BOOKMARK_INDICATION_COLOR,
- PreferenceConstants.EDITOR_BOOKMARK_INDICATION,
- PreferenceConstants.EDITOR_BOOKMARK_INDICATION_IN_OVERVIEW_RULER },
- {
- "Others",
- PreferenceConstants.EDITOR_UNKNOWN_INDICATION_COLOR,
- PreferenceConstants.EDITOR_UNKNOWN_INDICATION,
- PreferenceConstants.EDITOR_UNKNOWN_INDICATION_IN_OVERVIEW_RULER }
+ PreferencesMessages
+ .getString("JavaEditorPreferencePage.AnnotationDecoration.IBEAM"),
+ AnnotationPreference.STYLE_IBEAM} //$NON-NLS-1$
};
-
private OverlayPreferenceStore fOverlayStore;
private JavaTextTools fJavaTextTools;
- // private JavaEditorHoverConfigurationBlock fJavaEditorHoverConfigurationBlock;
-
+ // private JavaEditorHoverConfigurationBlock
+ // fJavaEditorHoverConfigurationBlock;
private Map fColorButtons = new HashMap();
private SelectionListener fColorButtonListener = new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
}
public void widgetSelected(SelectionEvent e) {
ColorEditor editor = (ColorEditor) e.widget.getData();
- PreferenceConverter.setValue(fOverlayStore, (String) fColorButtons.get(editor), editor.getColorValue());
+ PreferenceConverter.setValue(fOverlayStore, (String) fColorButtons
+ .get(editor), editor.getColorValue());
}
};
-
private Map fCheckBoxes = new HashMap();
private SelectionListener fCheckBoxListener = new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
}
public void widgetSelected(SelectionEvent e) {
Button button = (Button) e.widget;
- fOverlayStore.setValue((String) fCheckBoxes.get(button), button.getSelection());
+ fOverlayStore.setValue((String) fCheckBoxes.get(button), button
+ .getSelection());
}
};
-
private Map fTextFields = new HashMap();
private ModifyListener fTextFieldListener = new ModifyListener() {
public void modifyText(ModifyEvent e) {
fOverlayStore.setValue((String) fTextFields.get(text), text.getText());
}
};
-
private ArrayList fNumberFields = new ArrayList();
private ModifyListener fNumberFieldListener = new ModifyListener() {
public void modifyText(ModifyEvent e) {
numberFieldChanged((Text) e.widget);
}
};
-
private WorkbenchChainedTextFontFieldEditor fFontEditor;
private List fSyntaxColorList;
private List fAppearanceColorList;
- private List fProblemIndicationList;
+ private List fAnnotationList;
private ColorEditor fSyntaxForegroundColorEditor;
private ColorEditor fAppearanceForegroundColorEditor;
- private ColorEditor fProblemIndicationForegroundColorEditor;
+ private ColorEditor fAnnotationForegroundColorEditor;
private ColorEditor fBackgroundColorEditor;
private Button fBackgroundDefaultRadioButton;
private Button fBackgroundCustomRadioButton;
private Control fAutoInsertHTMLTriggerText;
private Button fShowInTextCheckBox;
private Button fShowInOverviewRulerCheckBox;
+ private Combo fDecorationStyleCombo;
+ private Button fHighlightInTextCheckBox;
+ private Button fShowInVerticalRulerCheckBox;
// private FileFieldEditor fUserDefinedPHPSyntaxFileFFE;
-
public PHPEditorPreferencePage() {
- setDescription(PHPUIMessages.getString("PHPEditorPreferencePage.description")); //$NON-NLS-1$
+ setDescription(PHPUIMessages
+ .getString("PHPEditorPreferencePage.description")); //$NON-NLS-1$
setPreferenceStore(PHPeclipsePlugin.getDefault().getPreferenceStore());
+ MarkerAnnotationPreferences markerAnnotationPreferences = new MarkerAnnotationPreferences();
+ fKeys = createOverlayStoreKeys(markerAnnotationPreferences);
fOverlayStore = new OverlayPreferenceStore(getPreferenceStore(), fKeys);
+ fAnnotationColorListModel = createAnnotationTypeListModel(markerAnnotationPreferences);
+ }
+ private OverlayPreferenceStore.OverlayKey[] createOverlayStoreKeys(
+ MarkerAnnotationPreferences preferences) {
+ ArrayList overlayKeys = new ArrayList();
+ Iterator e = preferences.getAnnotationPreferences().iterator();
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.STRING,
+ PreferenceConstants.EDITOR_PHP_FUNCTIONNAME_COLOR));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.EDITOR_PHP_FUNCTIONNAME_BOLD));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.STRING,
+ PreferenceConstants.EDITOR_PHP_VARIABLE_COLOR));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.EDITOR_PHP_VARIABLE_BOLD));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.STRING,
+ PreferenceConstants.EDITOR_PHP_CONSTANT_COLOR));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.EDITOR_PHP_CONSTANT_BOLD));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.STRING,
+ PreferenceConstants.EDITOR_PHP_TYPE_COLOR));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.EDITOR_PHP_TYPE_BOLD));
+ overlayKeys
+ .add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.STRING,
+ IPreferenceConstants.PHP_USERDEF_XMLFILE));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.EDITOR_CLOSE_STRINGS_PHP));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.EDITOR_CLOSE_BRACKETS_PHP));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.EDITOR_CLOSE_STRINGS_HTML));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.EDITOR_CLOSE_BRACKETS_HTML));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.STRING,
+ PreferenceConstants.EDITOR_FOREGROUND_COLOR));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.EDITOR_FOREGROUND_DEFAULT_COLOR));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.STRING,
+ PreferenceConstants.EDITOR_BACKGROUND_COLOR));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.EDITOR_BACKGROUND_DEFAULT_COLOR));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.INT, PreferenceConstants.EDITOR_TAB_WIDTH));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.STRING,
+ PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_COLOR));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_BOLD));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.STRING,
+ PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_COLOR));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_BOLD));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.STRING,
+ PreferenceConstants.EDITOR_JAVA_KEYWORD_COLOR));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.EDITOR_JAVA_KEYWORD_BOLD));
+ overlayKeys
+ .add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.STRING,
+ PreferenceConstants.EDITOR_STRING_COLOR));
+ overlayKeys
+ .add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.EDITOR_STRING_BOLD));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.STRING,
+ PreferenceConstants.EDITOR_JAVA_DEFAULT_COLOR));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.EDITOR_JAVA_DEFAULT_BOLD));
+ // overlayKeys.add(new
+ // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.EDITOR_TASK_TAG_COLOR));
+ // overlayKeys.add(new
+ // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_TASK_TAG_BOLD));
+ //
+ // overlayKeys.add(new
+ // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.EDITOR_JAVA_METHOD_NAME_COLOR));
+ // overlayKeys.add(new
+ // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_JAVA_METHOD_NAME_BOLD));
+ //
+ // overlayKeys.add(new
+ // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // PreferenceConstants.EDITOR_JAVA_OPERATOR_COLOR));
+ // overlayKeys.add(new
+ // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_JAVA_OPERATOR_BOLD));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.STRING,
+ PreferenceConstants.EDITOR_JAVADOC_KEYWORD_COLOR));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.EDITOR_JAVADOC_KEYWORD_BOLD));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.STRING,
+ PreferenceConstants.EDITOR_JAVADOC_TAG_COLOR));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.EDITOR_JAVADOC_TAG_BOLD));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.STRING,
+ PreferenceConstants.EDITOR_JAVADOC_LINKS_COLOR));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.EDITOR_JAVADOC_LINKS_BOLD));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.STRING,
+ PreferenceConstants.EDITOR_JAVADOC_DEFAULT_COLOR));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.EDITOR_JAVADOC_DEFAULT_BOLD));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.STRING,
+ PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.EDITOR_MATCHING_BRACKETS));
+ // overlayKeys.add(new
+ // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // ExtendedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR));
+ // overlayKeys.add(new
+ // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // ExtendedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE));
+ //
+ // overlayKeys.add(new
+ // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // ExtendedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLOR));
+ // overlayKeys.add(new
+ // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT,
+ // ExtendedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN));
+ // overlayKeys.add(new
+ // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // ExtendedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN));
+ //
+ // overlayKeys.add(new
+ // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_MARK_OCCURRENCES));
+ // overlayKeys.add(new
+ // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_STICKY_OCCURRENCES));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.STRING,
+ PreferenceConstants.EDITOR_FIND_SCOPE_COLOR));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_LINK_COLOR));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.EDITOR_CORRECTION_INDICATION));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.EDITOR_EVALUTE_TEMPORARY_PROBLEMS));
+ // overlayKeys.add(new
+ // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // ExtendedTextEditorPreferenceConstants.EDITOR_OVERVIEW_RULER));
+ // overlayKeys.add(new
+ // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ // ExtendedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR));
+ // overlayKeys.add(new
+ // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // ExtendedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.EDITOR_SPACES_FOR_TABS));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.CODEASSIST_AUTOACTIVATION));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.INT,
+ PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.CODEASSIST_AUTOINSERT));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.STRING,
+ PreferenceConstants.CODEASSIST_PROPOSALS_BACKGROUND));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.STRING,
+ PreferenceConstants.CODEASSIST_PROPOSALS_FOREGROUND));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.STRING,
+ PreferenceConstants.CODEASSIST_PARAMETERS_BACKGROUND));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.STRING,
+ PreferenceConstants.CODEASSIST_PARAMETERS_FOREGROUND));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.STRING,
+ PreferenceConstants.CODEASSIST_REPLACEMENT_BACKGROUND));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.STRING,
+ PreferenceConstants.CODEASSIST_REPLACEMENT_FOREGROUND));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.STRING,
+ PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.STRING,
+ PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVADOC));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.CODEASSIST_SHOW_VISIBLE_PROPOSALS));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.CODEASSIST_ORDER_PROPOSALS));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.CODEASSIST_CASE_SENSITIVITY));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.CODEASSIST_ADDIMPORT));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.CODEASSIST_INSERT_COMPLETION));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.CODEASSIST_GUESS_METHOD_ARGUMENTS));
+ overlayKeys
+ .add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.EDITOR_SMART_PASTE));
+ // overlayKeys.add(new
+ // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_CLOSE_STRINGS));
+ // overlayKeys.add(new
+ // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_CLOSE_BRACKETS));
+ overlayKeys
+ .add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.EDITOR_CLOSE_BRACES));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.EDITOR_CLOSE_JAVADOCS));
+ overlayKeys
+ .add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.EDITOR_WRAP_STRINGS));
+ // overlayKeys.add(new
+ // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_ESCAPE_STRINGS));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.EDITOR_ADD_JAVADOC_TAGS));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.EDITOR_SMART_HOME_END));
+ // overlayKeys.add(new
+ // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_SUB_WORD_NAVIGATION));
+ // overlayKeys.add(new
+ // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_DISABLE_OVERWRITE_MODE));
+ // overlayKeys.add(new
+ // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ // PreferenceConstants.EDITOR_SHOW_TEXT_HOVER_AFFORDANCE));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.STRING,
+ PreferenceConstants.EDITOR_TEXT_HOVER_MODIFIERS));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.STRING,
+ PreferenceConstants.EDITOR_TEXT_HOVER_MODIFIER_MASKS));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN,
+ PreferenceConstants.EDITOR_BROWSER_LIKE_LINKS));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.STRING,
+ PreferenceConstants.EDITOR_BROWSER_LIKE_LINKS_KEY_MODIFIER));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.STRING,
+ PreferenceConstants.EDITOR_BROWSER_LIKE_LINKS_KEY_MODIFIER_MASK));
+ while (e.hasNext()) {
+ AnnotationPreference info = (AnnotationPreference) e.next();
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.STRING, info.getColorPreferenceKey()));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN, info.getTextPreferenceKey()));
+ if (info.getHighlightPreferenceKey() != null)
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN, info.getHighlightPreferenceKey()));
+ overlayKeys
+ .add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN, info
+ .getOverviewRulerPreferenceKey()));
+ if (info.getVerticalRulerPreferenceKey() != null)
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.BOOLEAN, info
+ .getVerticalRulerPreferenceKey()));
+ if (info.getTextStylePreferenceKey() != null)
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+ OverlayPreferenceStore.STRING, info.getTextStylePreferenceKey()));
+ }
+ OverlayPreferenceStore.OverlayKey[] keys = new OverlayPreferenceStore.OverlayKey[overlayKeys
+ .size()];
+ overlayKeys.toArray(keys);
+ return keys;
}
-
/*
* @see IWorkbenchPreferencePage#init()
*/
public void init(IWorkbench workbench) {
}
-
/*
* @see PreferencePage#createControl(Composite)
*/
public void createControl(Composite parent) {
super.createControl(parent);
- // WorkbenchHelp.setHelp(getControl(), IJavaHelpContextIds.JAVA_EDITOR_PREFERENCE_PAGE);
+ // WorkbenchHelp.setHelp(getControl(),
+ // IJavaHelpContextIds.JAVA_EDITOR_PREFERENCE_PAGE);
}
-
private void handleSyntaxColorListSelection() {
int i = fSyntaxColorList.getSelectionIndex();
String key = fSyntaxColorListModel[i][1];
fSyntaxForegroundColorEditor.setColorValue(rgb);
fBoldCheckBox.setSelection(fOverlayStore.getBoolean(key + BOLD));
}
-
private void handleAppearanceColorListSelection() {
int i = fAppearanceColorList.getSelectionIndex();
String key = fAppearanceColorListModel[i][1];
RGB rgb = PreferenceConverter.getColor(fOverlayStore, key);
fAppearanceForegroundColorEditor.setColorValue(rgb);
}
-
- private void handleProblemIndicationColorListSelection() {
- int i = fProblemIndicationList.getSelectionIndex();
-
- String key = fProblemIndicationColorListModel[i][1];
+ // private void handleProblemIndicationColorListSelection() {
+ // int i = fProblemIndicationList.getSelectionIndex();
+ //
+ // String key = fProblemIndicationColorListModel[i][1];
+ // RGB rgb = PreferenceConverter.getColor(fOverlayStore, key);
+ // fProblemIndicationForegroundColorEditor.setColorValue(rgb);
+ //
+ // key = fProblemIndicationColorListModel[i][2];
+ // fShowInTextCheckBox.setSelection(fOverlayStore.getBoolean(key));
+ //
+ // key = fProblemIndicationColorListModel[i][3];
+ // fShowInOverviewRulerCheckBox.setSelection(fOverlayStore.getBoolean(key));
+ // }
+ private void handleAnnotationListSelection() {
+ int i = fAnnotationList.getSelectionIndex();
+ String key = fAnnotationColorListModel[i][1];
RGB rgb = PreferenceConverter.getColor(fOverlayStore, key);
- fProblemIndicationForegroundColorEditor.setColorValue(rgb);
-
- key = fProblemIndicationColorListModel[i][2];
- fShowInTextCheckBox.setSelection(fOverlayStore.getBoolean(key));
-
- key = fProblemIndicationColorListModel[i][3];
+ fAnnotationForegroundColorEditor.setColorValue(rgb);
+ key = fAnnotationColorListModel[i][2];
+ boolean showInText = fOverlayStore.getBoolean(key);
+ fShowInTextCheckBox.setSelection(showInText);
+ key = fAnnotationColorListModel[i][6];
+ if (key != null) {
+ fDecorationStyleCombo.setEnabled(showInText);
+ for (int j = 0; j < fAnnotationDecorationListModel.length; j++) {
+ String value = fOverlayStore.getString(key);
+ if (fAnnotationDecorationListModel[j][1].equals(value)) {
+ fDecorationStyleCombo.setText(fAnnotationDecorationListModel[j][0]);
+ break;
+ }
+ }
+ } else {
+ fDecorationStyleCombo.setEnabled(false);
+ fDecorationStyleCombo.setText(fAnnotationDecorationListModel[1][0]); // set
+ // selection
+ // to
+ // squigglies
+ // if
+ // the
+ // key
+ // is
+ // not
+ // there
+ // (legacy
+ // support)
+ }
+ key = fAnnotationColorListModel[i][3];
fShowInOverviewRulerCheckBox.setSelection(fOverlayStore.getBoolean(key));
+ key = fAnnotationColorListModel[i][4];
+ if (key != null) {
+ fHighlightInTextCheckBox.setSelection(fOverlayStore.getBoolean(key));
+ fHighlightInTextCheckBox.setEnabled(true);
+ } else
+ fHighlightInTextCheckBox.setEnabled(false);
+ key = fAnnotationColorListModel[i][5];
+ if (key != null) {
+ fShowInVerticalRulerCheckBox.setSelection(fOverlayStore.getBoolean(key));
+ fShowInVerticalRulerCheckBox.setEnabled(true);
+ } else {
+ fShowInVerticalRulerCheckBox.setSelection(true);
+ fShowInVerticalRulerCheckBox.setEnabled(false);
+ }
}
-
private Control createSyntaxPage(Composite parent) {
-
Composite colorComposite = new Composite(parent, SWT.NULL);
colorComposite.setLayout(new GridLayout());
-
Group backgroundComposite = new Group(colorComposite, SWT.SHADOW_ETCHED_IN);
backgroundComposite.setLayout(new RowLayout());
- backgroundComposite.setText(PHPUIMessages.getString("PHPEditorPreferencePage.backgroundColor")); //$NON-NLS-1$
-
+ backgroundComposite.setText(PHPUIMessages
+ .getString("PHPEditorPreferencePage.backgroundColor")); //$NON-NLS-1$
SelectionListener backgroundSelectionListener = new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
boolean custom = fBackgroundCustomRadioButton.getSelection();
fBackgroundColorButton.setEnabled(custom);
- fOverlayStore.setValue(PreferenceConstants.EDITOR_BACKGROUND_DEFAULT_COLOR, !custom);
+ fOverlayStore.setValue(
+ PreferenceConstants.EDITOR_BACKGROUND_DEFAULT_COLOR, !custom);
}
public void widgetDefaultSelected(SelectionEvent e) {
}
};
-
- fBackgroundDefaultRadioButton = new Button(backgroundComposite, SWT.RADIO | SWT.LEFT);
- fBackgroundDefaultRadioButton.setText(PHPUIMessages.getString("PHPEditorPreferencePage.systemDefault")); //$NON-NLS-1$
- fBackgroundDefaultRadioButton.addSelectionListener(backgroundSelectionListener);
-
- fBackgroundCustomRadioButton = new Button(backgroundComposite, SWT.RADIO | SWT.LEFT);
- fBackgroundCustomRadioButton.setText(PHPUIMessages.getString("PHPEditorPreferencePage.custom")); //$NON-NLS-1$
- fBackgroundCustomRadioButton.addSelectionListener(backgroundSelectionListener);
-
+ fBackgroundDefaultRadioButton = new Button(backgroundComposite, SWT.RADIO
+ | SWT.LEFT);
+ fBackgroundDefaultRadioButton.setText(PHPUIMessages
+ .getString("PHPEditorPreferencePage.systemDefault")); //$NON-NLS-1$
+ fBackgroundDefaultRadioButton
+ .addSelectionListener(backgroundSelectionListener);
+ fBackgroundCustomRadioButton = new Button(backgroundComposite, SWT.RADIO
+ | SWT.LEFT);
+ fBackgroundCustomRadioButton.setText(PHPUIMessages
+ .getString("PHPEditorPreferencePage.custom")); //$NON-NLS-1$
+ fBackgroundCustomRadioButton
+ .addSelectionListener(backgroundSelectionListener);
fBackgroundColorEditor = new ColorEditor(backgroundComposite);
fBackgroundColorButton = fBackgroundColorEditor.getButton();
-
// fUserDefinedPHPSyntaxFileFFE =
// new FileFieldEditor(
// IPreferenceConstants.PHP_USERDEF_XMLFILE,
// fUserDefinedPHPSyntaxFileFFE.setPreferencePage(this);
// fUserDefinedPHPSyntaxFileFFE.setPreferenceStore(getPreferenceStore());
// fUserDefinedPHPSyntaxFileFFE.load();
-
Label label = new Label(colorComposite, SWT.LEFT);
- label.setText(PHPUIMessages.getString("PHPEditorPreferencePage.foreground")); //$NON-NLS-1$
+ label
+ .setText(PHPUIMessages.getString("PHPEditorPreferencePage.foreground")); //$NON-NLS-1$
label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
Composite editorComposite = new Composite(colorComposite, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
editorComposite.setLayout(layout);
GridData gd = new GridData(GridData.FILL_BOTH);
editorComposite.setLayoutData(gd);
-
- fSyntaxColorList = new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER);
+ fSyntaxColorList = new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL
+ | SWT.BORDER);
gd = new GridData(GridData.FILL_BOTH);
gd.heightHint = convertHeightInCharsToPixels(5);
fSyntaxColorList.setLayoutData(gd);
-
Composite stylesComposite = new Composite(editorComposite, SWT.NONE);
layout = new GridLayout();
layout.marginHeight = 0;
layout.numColumns = 2;
stylesComposite.setLayout(layout);
stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
label = new Label(stylesComposite, SWT.LEFT);
label.setText(PHPUIMessages.getString("PHPEditorPreferencePage.color")); //$NON-NLS-1$
gd = new GridData();
gd.horizontalAlignment = GridData.BEGINNING;
label.setLayoutData(gd);
-
fSyntaxForegroundColorEditor = new ColorEditor(stylesComposite);
Button foregroundColorButton = fSyntaxForegroundColorEditor.getButton();
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalAlignment = GridData.BEGINNING;
foregroundColorButton.setLayoutData(gd);
-
fBoldCheckBox = new Button(stylesComposite, SWT.CHECK);
- fBoldCheckBox.setText(PHPUIMessages.getString("PHPEditorPreferencePage.bold")); //$NON-NLS-1$
+ fBoldCheckBox.setText(PHPUIMessages
+ .getString("PHPEditorPreferencePage.bold")); //$NON-NLS-1$
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalAlignment = GridData.BEGINNING;
gd.horizontalSpan = 2;
fBoldCheckBox.setLayoutData(gd);
-
label = new Label(colorComposite, SWT.LEFT);
label.setText(PHPUIMessages.getString("PHPEditorPreferencePage.preview")); //$NON-NLS-1$
label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
Control previewer = createPreviewer(colorComposite);
gd = new GridData(GridData.FILL_BOTH);
gd.widthHint = convertWidthInCharsToPixels(20);
gd.heightHint = convertHeightInCharsToPixels(5);
previewer.setLayoutData(gd);
-
fSyntaxColorList.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
// do nothing
handleSyntaxColorListSelection();
}
});
-
foregroundColorButton.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
// do nothing
public void widgetSelected(SelectionEvent e) {
int i = fSyntaxColorList.getSelectionIndex();
String key = fSyntaxColorListModel[i][1];
-
- PreferenceConverter.setValue(fOverlayStore, key, fSyntaxForegroundColorEditor.getColorValue());
+ PreferenceConverter.setValue(fOverlayStore, key,
+ fSyntaxForegroundColorEditor.getColorValue());
}
});
-
fBackgroundColorButton.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
// do nothing
}
public void widgetSelected(SelectionEvent e) {
- PreferenceConverter.setValue(
- fOverlayStore,
- PreferenceConstants.EDITOR_BACKGROUND_COLOR,
- fBackgroundColorEditor.getColorValue());
+ PreferenceConverter.setValue(fOverlayStore,
+ PreferenceConstants.EDITOR_BACKGROUND_COLOR, fBackgroundColorEditor
+ .getColorValue());
}
});
-
fBoldCheckBox.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
// do nothing
fOverlayStore.setValue(key + BOLD, fBoldCheckBox.getSelection());
}
});
-
return colorComposite;
}
-
private Control createPreviewer(Composite parent) {
Preferences coreStore = createTemporaryCorePreferenceStore();
-
fJavaTextTools = new JavaTextTools(fOverlayStore, coreStore, false);
-
- fPreviewViewer = new SourceViewer(parent, null, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
- fPreviewViewer.configure(new PHPSourceViewerConfiguration(fJavaTextTools, null));
- fPreviewViewer.getTextWidget().setFont(JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT));
+ fPreviewViewer = new SourceViewer(parent, null, SWT.V_SCROLL | SWT.H_SCROLL
+ | SWT.BORDER);
+ fPreviewViewer.configure(new PHPSourceViewerConfiguration(fJavaTextTools,
+ null));
+ fPreviewViewer.getTextWidget().setFont(
+ JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT));
fPreviewViewer.setEditable(false);
-
initializeViewerColors(fPreviewViewer);
-
String content = loadPreviewContentFromFile("ColorSettingPreviewCode.txt"); //$NON-NLS-1$
IDocument document = new Document(content);
// PHPEditorEnvironment pe;
- IDocumentPartitioner partitioner = fJavaTextTools.createDocumentPartitioner();
+ IDocumentPartitioner partitioner = fJavaTextTools
+ .createDocumentPartitioner();
partitioner.connect(document);
document.setDocumentPartitioner(partitioner);
-
fPreviewViewer.setDocument(document);
-
fOverlayStore.addPropertyChangeListener(new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
String p = event.getProperty();
if (p.equals(PreferenceConstants.EDITOR_BACKGROUND_COLOR)
- || p.equals(PreferenceConstants.EDITOR_BACKGROUND_DEFAULT_COLOR)) {
+ || p.equals(PreferenceConstants.EDITOR_BACKGROUND_DEFAULT_COLOR)) {
initializeViewerColors(fPreviewViewer);
}
-
fPreviewViewer.invalidateTextPresentation();
}
});
-
return fPreviewViewer.getControl();
}
private Preferences createTemporaryCorePreferenceStore() {
Preferences result = new Preferences();
-
result.setValue(COMPILER_TASK_TAGS, "TASK"); //$NON-NLS-1$
-
return result;
}
/**
* Initializes the given viewer's colors.
*
- * @param viewer the viewer to be initialized
+ * @param viewer
+ * the viewer to be initialized
*/
private void initializeViewerColors(ISourceViewer viewer) {
-
IPreferenceStore store = fOverlayStore;
if (store != null) {
-
StyledText styledText = viewer.getTextWidget();
-
// ---------- background color ----------------------
- Color color =
- store.getBoolean(PreferenceConstants.EDITOR_BACKGROUND_DEFAULT_COLOR)
+ Color color = store
+ .getBoolean(PreferenceConstants.EDITOR_BACKGROUND_DEFAULT_COLOR)
? null
- : createColor(store, PreferenceConstants.EDITOR_BACKGROUND_COLOR, styledText.getDisplay());
+ : createColor(store, PreferenceConstants.EDITOR_BACKGROUND_COLOR,
+ styledText.getDisplay());
styledText.setBackground(color);
-
if (fBackgroundColor != null)
fBackgroundColor.dispose();
-
fBackgroundColor = color;
}
}
-
/**
* Creates a color from the information stored in the given preference store.
* Returns <code>null</code> if there is no such information available.
*/
private Color createColor(IPreferenceStore store, String key, Display display) {
-
RGB rgb = null;
-
if (store.contains(key)) {
-
if (store.isDefault(key))
rgb = PreferenceConverter.getDefaultColor(store, key);
else
rgb = PreferenceConverter.getColor(store, key);
-
if (rgb != null)
return new Color(display, rgb);
}
-
return null;
}
-
// sets enabled flag for a control and all its sub-tree
private static void setEnabled(Control control, boolean enable) {
control.setEnabled(enable);
setEnabled(children[i], enable);
}
}
-
private Control createAppearancePage(Composite parent) {
-
Composite appearanceComposite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
appearanceComposite.setLayout(layout);
-
String label = PHPUIMessages.getString("PHPEditorPreferencePage.textFont"); //$NON-NLS-1$
addTextFontEditor(appearanceComposite, label, JFaceResources.TEXT_FONT);
-
- label = PHPUIMessages.getString("PHPEditorPreferencePage.displayedTabWidth"); //$NON-NLS-1$
- addTextField(appearanceComposite, label, PreferenceConstants.EDITOR_TAB_WIDTH, 3, 0, true);
-
- label = PHPUIMessages.getString("PHPEditorPreferencePage.printMarginColumn"); //$NON-NLS-1$
- addTextField(appearanceComposite, label, PreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN, 3, 0, true);
-
- // label= PHPUIMessages.getString("PHPEditorPreferencePage.synchronizeOnCursor"); //$NON-NLS-1$
- // addCheckBox(appearanceComposite, label, PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE, 0);
-
- label = PHPUIMessages.getString("PHPEditorPreferencePage.showOverviewRuler"); //$NON-NLS-1$
- addCheckBox(appearanceComposite, label, PreferenceConstants.EDITOR_OVERVIEW_RULER, 0);
-
+ label = PHPUIMessages
+ .getString("PHPEditorPreferencePage.displayedTabWidth"); //$NON-NLS-1$
+ addTextField(appearanceComposite, label,
+ PreferenceConstants.EDITOR_TAB_WIDTH, 3, 0, true);
+ label = PHPUIMessages
+ .getString("PHPEditorPreferencePage.printMarginColumn"); //$NON-NLS-1$
+ addTextField(appearanceComposite, label,
+ PreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN, 3, 0, true);
+ // label=
+ // PHPUIMessages.getString("PHPEditorPreferencePage.synchronizeOnCursor");
+ // //$NON-NLS-1$
+ // addCheckBox(appearanceComposite, label,
+ // PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE, 0);
+ label = PHPUIMessages
+ .getString("PHPEditorPreferencePage.showOverviewRuler"); //$NON-NLS-1$
+ addCheckBox(appearanceComposite, label,
+ PreferenceConstants.EDITOR_OVERVIEW_RULER, 0);
label = PHPUIMessages.getString("PHPEditorPreferencePage.showLineNumbers"); //$NON-NLS-1$
- addCheckBox(appearanceComposite, label, PreferenceConstants.EDITOR_LINE_NUMBER_RULER, 0);
-
- label = PHPUIMessages.getString("PHPEditorPreferencePage.highlightMatchingBrackets"); //$NON-NLS-1$
- addCheckBox(appearanceComposite, label, PreferenceConstants.EDITOR_MATCHING_BRACKETS, 0);
-
- label = PHPUIMessages.getString("PHPEditorPreferencePage.highlightCurrentLine"); //$NON-NLS-1$
- addCheckBox(appearanceComposite, label, PreferenceConstants.EDITOR_CURRENT_LINE, 0);
-
+ addCheckBox(appearanceComposite, label,
+ PreferenceConstants.EDITOR_LINE_NUMBER_RULER, 0);
+ label = PHPUIMessages
+ .getString("PHPEditorPreferencePage.highlightMatchingBrackets"); //$NON-NLS-1$
+ addCheckBox(appearanceComposite, label,
+ PreferenceConstants.EDITOR_MATCHING_BRACKETS, 0);
+ label = PHPUIMessages
+ .getString("PHPEditorPreferencePage.highlightCurrentLine"); //$NON-NLS-1$
+ addCheckBox(appearanceComposite, label,
+ PreferenceConstants.EDITOR_CURRENT_LINE, 0);
label = PHPUIMessages.getString("PHPEditorPreferencePage.showPrintMargin"); //$NON-NLS-1$
- addCheckBox(appearanceComposite, label, PreferenceConstants.EDITOR_PRINT_MARGIN, 0);
-
+ addCheckBox(appearanceComposite, label,
+ PreferenceConstants.EDITOR_PRINT_MARGIN, 0);
Label l = new Label(appearanceComposite, SWT.LEFT);
GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gd.horizontalSpan = 2;
gd.heightHint = convertHeightInCharsToPixels(1) / 2;
l.setLayoutData(gd);
-
l = new Label(appearanceComposite, SWT.LEFT);
- l.setText(PHPUIMessages.getString("PHPEditorPreferencePage.appearanceOptions")); //$NON-NLS-1$
+ l.setText(PHPUIMessages
+ .getString("PHPEditorPreferencePage.appearanceOptions")); //$NON-NLS-1$
gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gd.horizontalSpan = 2;
l.setLayoutData(gd);
-
Composite editorComposite = new Composite(appearanceComposite, SWT.NONE);
layout = new GridLayout();
layout.numColumns = 2;
gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL);
gd.horizontalSpan = 2;
editorComposite.setLayoutData(gd);
-
- fAppearanceColorList = new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER);
+ fAppearanceColorList = new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL
+ | SWT.BORDER);
gd = new GridData(GridData.FILL_BOTH);
gd.heightHint = convertHeightInCharsToPixels(5);
fAppearanceColorList.setLayoutData(gd);
-
Composite stylesComposite = new Composite(editorComposite, SWT.NONE);
layout = new GridLayout();
layout.marginHeight = 0;
layout.numColumns = 2;
stylesComposite.setLayout(layout);
stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
l = new Label(stylesComposite, SWT.LEFT);
l.setText(PHPUIMessages.getString("PHPEditorPreferencePage.color")); //$NON-NLS-1$
gd = new GridData();
gd.horizontalAlignment = GridData.BEGINNING;
l.setLayoutData(gd);
-
fAppearanceForegroundColorEditor = new ColorEditor(stylesComposite);
Button foregroundColorButton = fAppearanceForegroundColorEditor.getButton();
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalAlignment = GridData.BEGINNING;
foregroundColorButton.setLayoutData(gd);
-
fAppearanceColorList.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
// do nothing
public void widgetSelected(SelectionEvent e) {
int i = fAppearanceColorList.getSelectionIndex();
String key = fAppearanceColorListModel[i][1];
-
- PreferenceConverter.setValue(fOverlayStore, key, fAppearanceForegroundColorEditor.getColorValue());
+ PreferenceConverter.setValue(fOverlayStore, key,
+ fAppearanceForegroundColorEditor.getColorValue());
}
});
return appearanceComposite;
}
-
- private Control createProblemIndicationPage(Composite parent) {
+ private Control createAnnotationsPage(Composite parent) {
Composite composite = new Composite(parent, SWT.NULL);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
composite.setLayout(layout);
-
- // String text = "Analyse &problems while typing";
- // addCheckBox(composite, text, PreferenceConstants.EDITOR_EVALUTE_TEMPORARY_PROBLEMS, 0);
- //
- // text = PHPUIMessages.getString("PHPEditorPreferencePage.showQuickFixables"); //$NON-NLS-1$
- // addCheckBox(composite, text, PreferenceConstants.EDITOR_CORRECTION_INDICATION, 0);
-
+ String text = PreferencesMessages
+ .getString("JavaEditorPreferencePage.analyseAnnotationsWhileTyping"); //$NON-NLS-1$
+ addCheckBox(composite, text,
+ PreferenceConstants.EDITOR_EVALUTE_TEMPORARY_PROBLEMS, 0);
+ text = PreferencesMessages
+ .getString("JavaEditorPreferencePage.showQuickFixables"); //$NON-NLS-1$
+ addCheckBox(composite, text,
+ PreferenceConstants.EDITOR_CORRECTION_INDICATION, 0);
+ addFiller(composite);
Label label = new Label(composite, SWT.LEFT);
+ label.setText(PreferencesMessages
+ .getString("JavaEditorPreferencePage.annotationPresentationOptions")); //$NON-NLS-1$
GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gd.horizontalSpan = 2;
- gd.heightHint = convertHeightInCharsToPixels(1) / 2;
- label.setLayoutData(gd);
-
- label = new Label(composite, SWT.LEFT);
- label.setText("&Marker presentation options:");
- gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- gd.horizontalSpan = 2;
label.setLayoutData(gd);
-
Composite editorComposite = new Composite(composite, SWT.NONE);
layout = new GridLayout();
layout.numColumns = 2;
gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL);
gd.horizontalSpan = 2;
editorComposite.setLayoutData(gd);
-
- fProblemIndicationList = new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER);
- gd = new GridData(GridData.FILL_BOTH);
- gd.heightHint = convertHeightInCharsToPixels(5);
- fProblemIndicationList.setLayoutData(gd);
-
+ fAnnotationList = new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL
+ | SWT.BORDER);
+ gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING
+ | GridData.FILL_HORIZONTAL);
+ gd.heightHint = convertHeightInCharsToPixels(10);
+ fAnnotationList.setLayoutData(gd);
Composite optionsComposite = new Composite(editorComposite, SWT.NONE);
layout = new GridLayout();
layout.marginHeight = 0;
layout.numColumns = 2;
optionsComposite.setLayout(layout);
optionsComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
fShowInTextCheckBox = new Button(optionsComposite, SWT.CHECK);
- fShowInTextCheckBox.setText("Show in &text");
+ fShowInTextCheckBox.setText(PreferencesMessages
+ .getString("JavaEditorPreferencePage.annotations.showInText")); //$NON-NLS-1$
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalAlignment = GridData.BEGINNING;
gd.horizontalSpan = 2;
fShowInTextCheckBox.setLayoutData(gd);
-
+ fDecorationStyleCombo = new Combo(optionsComposite, SWT.READ_ONLY);
+ for (int i = 0; i < fAnnotationDecorationListModel.length; i++)
+ fDecorationStyleCombo.add(fAnnotationDecorationListModel[i][0]);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalAlignment = GridData.BEGINNING;
+ gd.horizontalSpan = 2;
+ gd.horizontalIndent = 20;
+ fDecorationStyleCombo.setLayoutData(gd);
+ fHighlightInTextCheckBox = new Button(optionsComposite, SWT.CHECK);
+ fHighlightInTextCheckBox.setText(PreferencesMessages
+ .getString("TextEditorPreferencePage.annotations.highlightInText")); //$NON-NLS-1$
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalAlignment = GridData.BEGINNING;
+ gd.horizontalSpan = 2;
+ fHighlightInTextCheckBox.setLayoutData(gd);
fShowInOverviewRulerCheckBox = new Button(optionsComposite, SWT.CHECK);
- fShowInOverviewRulerCheckBox.setText("Show in overview &ruler");
+ fShowInOverviewRulerCheckBox.setText(PreferencesMessages
+ .getString("JavaEditorPreferencePage.annotations.showInOverviewRuler")); //$NON-NLS-1$
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalAlignment = GridData.BEGINNING;
gd.horizontalSpan = 2;
fShowInOverviewRulerCheckBox.setLayoutData(gd);
-
+ fShowInVerticalRulerCheckBox = new Button(optionsComposite, SWT.CHECK);
+ fShowInVerticalRulerCheckBox.setText(PreferencesMessages
+ .getString("JavaEditorPreferencePage.annotations.showInVerticalRuler")); //$NON-NLS-1$
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalAlignment = GridData.BEGINNING;
+ gd.horizontalSpan = 2;
+ fShowInVerticalRulerCheckBox.setLayoutData(gd);
label = new Label(optionsComposite, SWT.LEFT);
- label.setText("C&olor:");
+ label.setText(PreferencesMessages
+ .getString("JavaEditorPreferencePage.annotations.color")); //$NON-NLS-1$
gd = new GridData();
gd.horizontalAlignment = GridData.BEGINNING;
label.setLayoutData(gd);
-
- fProblemIndicationForegroundColorEditor = new ColorEditor(optionsComposite);
- Button foregroundColorButton = fProblemIndicationForegroundColorEditor.getButton();
+ fAnnotationForegroundColorEditor = new ColorEditor(optionsComposite);
+ Button foregroundColorButton = fAnnotationForegroundColorEditor.getButton();
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalAlignment = GridData.BEGINNING;
foregroundColorButton.setLayoutData(gd);
-
- fProblemIndicationList.addSelectionListener(new SelectionListener() {
+ fAnnotationList.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
// do nothing
}
-
public void widgetSelected(SelectionEvent e) {
- handleProblemIndicationColorListSelection();
+ handleAnnotationListSelection();
}
});
-
fShowInTextCheckBox.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
// do nothing
}
-
public void widgetSelected(SelectionEvent e) {
- int i = fProblemIndicationList.getSelectionIndex();
- String key = fProblemIndicationColorListModel[i][2];
+ int i = fAnnotationList.getSelectionIndex();
+ String key = fAnnotationColorListModel[i][2];
fOverlayStore.setValue(key, fShowInTextCheckBox.getSelection());
+ String decorationKey = fAnnotationColorListModel[i][6];
+ fDecorationStyleCombo.setEnabled(decorationKey != null
+ && fShowInTextCheckBox.getSelection());
+ }
+ });
+ fHighlightInTextCheckBox.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // do nothing
+ }
+ public void widgetSelected(SelectionEvent e) {
+ int i = fAnnotationList.getSelectionIndex();
+ String key = fAnnotationColorListModel[i][4];
+ fOverlayStore.setValue(key, fHighlightInTextCheckBox.getSelection());
}
});
-
fShowInOverviewRulerCheckBox.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
// do nothing
}
-
public void widgetSelected(SelectionEvent e) {
- int i = fProblemIndicationList.getSelectionIndex();
- String key = fProblemIndicationColorListModel[i][3];
- fOverlayStore.setValue(key, fShowInOverviewRulerCheckBox.getSelection());
+ int i = fAnnotationList.getSelectionIndex();
+ String key = fAnnotationColorListModel[i][3];
+ fOverlayStore
+ .setValue(key, fShowInOverviewRulerCheckBox.getSelection());
+ }
+ });
+ fShowInVerticalRulerCheckBox.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // do nothing
+ }
+ public void widgetSelected(SelectionEvent e) {
+ int i = fAnnotationList.getSelectionIndex();
+ String key = fAnnotationColorListModel[i][5];
+ fOverlayStore
+ .setValue(key, fShowInVerticalRulerCheckBox.getSelection());
}
});
-
foregroundColorButton.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
// do nothing
}
-
public void widgetSelected(SelectionEvent e) {
- int i = fProblemIndicationList.getSelectionIndex();
- String key = fProblemIndicationColorListModel[i][1];
- PreferenceConverter.setValue(fOverlayStore, key, fProblemIndicationForegroundColorEditor.getColorValue());
+ int i = fAnnotationList.getSelectionIndex();
+ String key = fAnnotationColorListModel[i][1];
+ PreferenceConverter.setValue(fOverlayStore, key,
+ fAnnotationForegroundColorEditor.getColorValue());
+ }
+ });
+ fDecorationStyleCombo.addSelectionListener(new SelectionListener() {
+ /**
+ * {@inheritdoc}
+ */
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // do nothing
+ }
+ /**
+ * {@inheritdoc}
+ */
+ public void widgetSelected(SelectionEvent e) {
+ int i = fAnnotationList.getSelectionIndex();
+ String key = fAnnotationColorListModel[i][6];
+ if (key != null) {
+ for (int j = 0; j < fAnnotationDecorationListModel.length; j++) {
+ if (fAnnotationDecorationListModel[j][0]
+ .equals(fDecorationStyleCombo.getText())) {
+ fOverlayStore.setValue(key, fAnnotationDecorationListModel[j][1]);
+ break;
+ }
+ }
+ }
}
});
-
return composite;
}
-
+ private String[][] createAnnotationTypeListModel(
+ MarkerAnnotationPreferences preferences) {
+ ArrayList listModelItems = new ArrayList();
+ SortedSet sortedPreferences = new TreeSet(new Comparator() {
+ /*
+ * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+ */
+ public int compare(Object o1, Object o2) {
+ if (!(o2 instanceof AnnotationPreference))
+ return -1;
+ if (!(o1 instanceof AnnotationPreference))
+ return 1;
+ AnnotationPreference a1 = (AnnotationPreference) o1;
+ AnnotationPreference a2 = (AnnotationPreference) o2;
+ return Collator.getInstance().compare(a1.getPreferenceLabel(),
+ a2.getPreferenceLabel());
+ }
+ });
+ sortedPreferences.addAll(preferences.getAnnotationPreferences());
+ Iterator e = sortedPreferences.iterator();
+ while (e.hasNext()) {
+ AnnotationPreference info = (AnnotationPreference) e.next();
+ listModelItems.add(new String[]{info.getPreferenceLabel(),
+ info.getColorPreferenceKey(), info.getTextPreferenceKey(),
+ info.getOverviewRulerPreferenceKey(),
+ info.getHighlightPreferenceKey(),
+ info.getVerticalRulerPreferenceKey(),
+ info.getTextStylePreferenceKey()});
+ }
+ String[][] items = new String[listModelItems.size()][];
+ listModelItems.toArray(items);
+ return items;
+ }
private Control createBehaviourPage(Composite parent) {
Composite composite = new Composite(parent, SWT.NULL);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
composite.setLayout(layout);
String label;
- // String label= PHPUIMessages.getString("PHPEditorPreferencePage.wrapStrings"); //$NON-NLS-1$
- // addCheckBox(composite, label, PreferenceConstants.EDITOR_WRAP_STRINGS, 1);
-
- // label= PHPUIMessages.getString("PHPEditorPreferencePage.smartHomeEnd"); //$NON-NLS-1$
- // addCheckBox(composite, label, PreferenceConstants.EDITOR_SMART_HOME_END, 1);
+ // String label=
+ // PHPUIMessages.getString("PHPEditorPreferencePage.wrapStrings");
+ // //$NON-NLS-1$
+ // addCheckBox(composite, label, PreferenceConstants.EDITOR_WRAP_STRINGS,
+ // 1);
+ // label= PHPUIMessages.getString("PHPEditorPreferencePage.smartHomeEnd");
+ // //$NON-NLS-1$
+ // addCheckBox(composite, label, PreferenceConstants.EDITOR_SMART_HOME_END,
+ // 1);
//
- // label= PHPUIMessages.getString("PHPEditorPreferencePage.smartPaste"); //$NON-NLS-1$
- // addCheckBox(composite, label, PreferenceConstants.EDITOR_SMART_PASTE, 1);
-
- label = PHPUIMessages.getString("PHPEditorPreferencePage.insertSpaceForTabs"); //$NON-NLS-1$
+ // label= PHPUIMessages.getString("PHPEditorPreferencePage.smartPaste");
+ // //$NON-NLS-1$
+ // addCheckBox(composite, label, PreferenceConstants.EDITOR_SMART_PASTE,
+ // 1);
+ label = PHPUIMessages
+ .getString("PHPEditorPreferencePage.insertSpaceForTabs"); //$NON-NLS-1$
addCheckBox(composite, label, PreferenceConstants.EDITOR_SPACES_FOR_TABS, 1);
-
label = PHPUIMessages.getString("PHPEditorPreferencePage.closeStringsPHP"); //$NON-NLS-1$
- addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_STRINGS_PHP, 1);
-
+ addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_STRINGS_PHP,
+ 1);
label = PHPUIMessages.getString("PHPEditorPreferencePage.closeBracketsPHP"); //$NON-NLS-1$
- addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_BRACKETS_PHP, 1);
-
- // label= PHPUIMessages.getString("PHPEditorPreferencePage.closeBraces"); //$NON-NLS-1$
- // addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_BRACES, 1);
+ addCheckBox(composite, label,
+ PreferenceConstants.EDITOR_CLOSE_BRACKETS_PHP, 1);
+ // label= PHPUIMessages.getString("PHPEditorPreferencePage.closeBraces");
+ // //$NON-NLS-1$
+ // addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_BRACES,
+ // 1);
//
- // label= PHPUIMessages.getString("PHPEditorPreferencePage.closePHPDocs"); //$NON-NLS-1$
- // Button button= addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_JAVADOCS, 1);
+ // label= PHPUIMessages.getString("PHPEditorPreferencePage.closePHPDocs");
+ // //$NON-NLS-1$
+ // Button button= addCheckBox(composite, label,
+ // PreferenceConstants.EDITOR_CLOSE_JAVADOCS, 1);
//
- // label= PHPUIMessages.getString("PHPEditorPreferencePage.addPHPDocTags"); //$NON-NLS-1$
- // fAddJavaDocTagsButton= addCheckBox(composite, label, PreferenceConstants.EDITOR_ADD_JAVADOC_TAGS, 1);
+ // label= PHPUIMessages.getString("PHPEditorPreferencePage.addPHPDocTags");
+ // //$NON-NLS-1$
+ // fAddJavaDocTagsButton= addCheckBox(composite, label,
+ // PreferenceConstants.EDITOR_ADD_JAVADOC_TAGS, 1);
// createDependency(button, fAddJavaDocTagsButton);
-
- // label= PHPUIMessages.getString("PHPEditorPreferencePage.formatPHPDocs"); //$NON-NLS-1$
- // addCheckBox(composite, label, PreferenceConstants.EDITOR_FORMAT_JAVADOCS, 1);
+ // label= PHPUIMessages.getString("PHPEditorPreferencePage.formatPHPDocs");
+ // //$NON-NLS-1$
+ // addCheckBox(composite, label,
+ // PreferenceConstants.EDITOR_FORMAT_JAVADOCS, 1);
//
label = PHPUIMessages.getString("PHPEditorPreferencePage.closeStringsHTML"); //$NON-NLS-1$
- addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_STRINGS_HTML, 1);
-
- label = PHPUIMessages.getString("PHPEditorPreferencePage.closeBracketsHTML"); //$NON-NLS-1$
- addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_BRACKETS_HTML, 1);
+ addCheckBox(composite, label,
+ PreferenceConstants.EDITOR_CLOSE_STRINGS_HTML, 1);
+ label = PHPUIMessages
+ .getString("PHPEditorPreferencePage.closeBracketsHTML"); //$NON-NLS-1$
+ addCheckBox(composite, label,
+ PreferenceConstants.EDITOR_CLOSE_BRACKETS_HTML, 1);
return composite;
}
-
private static void indent(Control control) {
GridData gridData = new GridData();
gridData.horizontalIndent = 20;
control.setLayoutData(gridData);
}
-
private static void createDependency(final Button master, final Control slave) {
indent(slave);
master.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
slave.setEnabled(master.getSelection());
}
-
public void widgetDefaultSelected(SelectionEvent e) {
}
});
}
-
private Control createContentAssistPage(Composite parent) {
-
Composite contentAssistComposite = new Composite(parent, SWT.NULL);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
contentAssistComposite.setLayout(layout);
String label;
- // String label = PHPUIMessages.getString("PHPEditorPreferencePage.insertSingleProposalsAutomatically"); //$NON-NLS-1$
- // addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOINSERT, 0);
+ // String label =
+ // PHPUIMessages.getString("PHPEditorPreferencePage.insertSingleProposalsAutomatically");
+ // //$NON-NLS-1$
+ // addCheckBox(contentAssistComposite, label,
+ // PreferenceConstants.CODEASSIST_AUTOINSERT, 0);
//
- // label = PHPUIMessages.getString("PHPEditorPreferencePage.showOnlyProposalsVisibleInTheInvocationContext"); //$NON-NLS-1$
- // addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_SHOW_VISIBLE_PROPOSALS, 0);
+ // label =
+ // PHPUIMessages.getString("PHPEditorPreferencePage.showOnlyProposalsVisibleInTheInvocationContext");
+ // //$NON-NLS-1$
+ // addCheckBox(contentAssistComposite, label,
+ // PreferenceConstants.CODEASSIST_SHOW_VISIBLE_PROPOSALS, 0);
//
- // label = PHPUIMessages.getString("PHPEditorPreferencePage.presentProposalsInAlphabeticalOrder"); //$NON-NLS-1$
- // addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_ORDER_PROPOSALS, 0);
+ // label =
+ // PHPUIMessages.getString("PHPEditorPreferencePage.presentProposalsInAlphabeticalOrder");
+ // //$NON-NLS-1$
+ // addCheckBox(contentAssistComposite, label,
+ // PreferenceConstants.CODEASSIST_ORDER_PROPOSALS, 0);
//
- // label = PHPUIMessages.getString("PHPEditorPreferencePage.automaticallyAddImportInsteadOfQualifiedName"); //$NON-NLS-1$
- // addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_ADDIMPORT, 0);
+ // label =
+ // PHPUIMessages.getString("PHPEditorPreferencePage.automaticallyAddImportInsteadOfQualifiedName");
+ // //$NON-NLS-1$
+ // addCheckBox(contentAssistComposite, label,
+ // PreferenceConstants.CODEASSIST_ADDIMPORT, 0);
//
- // label = PHPUIMessages.getString("PHPEditorPreferencePage.insertCompletion"); //$NON-NLS-1$
- // addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_INSERT_COMPLETION, 0);
+ // label =
+ // PHPUIMessages.getString("PHPEditorPreferencePage.insertCompletion");
+ // //$NON-NLS-1$
+ // addCheckBox(contentAssistComposite, label,
+ // PreferenceConstants.CODEASSIST_INSERT_COMPLETION, 0);
//
- // label = PHPUIMessages.getString("PHPEditorPreferencePage.fillArgumentNamesOnMethodCompletion"); //$NON-NLS-1$
- // Button button = addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES, 0);
+ // label =
+ // PHPUIMessages.getString("PHPEditorPreferencePage.fillArgumentNamesOnMethodCompletion");
+ // //$NON-NLS-1$
+ // Button button = addCheckBox(contentAssistComposite, label,
+ // PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES, 0);
//
- // label = PHPUIMessages.getString("PHPEditorPreferencePage.guessArgumentNamesOnMethodCompletion"); //$NON-NLS-1$
+ // label =
+ // PHPUIMessages.getString("PHPEditorPreferencePage.guessArgumentNamesOnMethodCompletion");
+ // //$NON-NLS-1$
// fGuessMethodArgumentsButton =
- // addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_GUESS_METHOD_ARGUMENTS, 0);
+ // addCheckBox(contentAssistComposite, label,
+ // PreferenceConstants.CODEASSIST_GUESS_METHOD_ARGUMENTS, 0);
// createDependency(button, fGuessMethodArgumentsButton);
-
- label = PHPUIMessages.getString("PHPEditorPreferencePage.enableAutoActivation"); //$NON-NLS-1$
- final Button autoactivation = addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOACTIVATION, 0);
-
- label = PHPUIMessages.getString("PHPEditorPreferencePage.autoActivationDelay"); //$NON-NLS-1$
- fAutoInsertDelayText =
- addTextField(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY, 4, 0, true);
-
- label = PHPUIMessages.getString("PHPEditorPreferencePage.autoActivationTriggersForPHP"); //$NON-NLS-1$
- fAutoInsertJavaTriggerText =
- addTextField(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA, 4, 0, false);
-
- label = PHPUIMessages.getString("PHPEditorPreferencePage.autoActivationTriggersForPHPDoc"); //$NON-NLS-1$
- fAutoInsertJavaDocTriggerText =
- addTextField(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVADOC, 4, 0, false);
-
- label = PHPUIMessages.getString("PHPEditorPreferencePage.autoActivationTriggersForHTML"); //$NON-NLS-1$
- fAutoInsertHTMLTriggerText =
- addTextField(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_HTML, 4, 0, false);
-
- label = PHPUIMessages.getString("PHPEditorPreferencePage.backgroundForCompletionProposals"); //$NON-NLS-1$
- addColorButton(contentAssistComposite, label, PreferenceConstants.CODEASSIST_PROPOSALS_BACKGROUND, 0);
-
- label = PHPUIMessages.getString("PHPEditorPreferencePage.foregroundForCompletionProposals"); //$NON-NLS-1$
- addColorButton(contentAssistComposite, label, PreferenceConstants.CODEASSIST_PROPOSALS_FOREGROUND, 0);
-
- // label = PHPUIMessages.getString("PHPEditorPreferencePage.backgroundForMethodParameters"); //$NON-NLS-1$
- // addColorButton(contentAssistComposite, label, PreferenceConstants.CODEASSIST_PARAMETERS_BACKGROUND, 0);
+ label = PHPUIMessages
+ .getString("PHPEditorPreferencePage.enableAutoActivation"); //$NON-NLS-1$
+ final Button autoactivation = addCheckBox(contentAssistComposite, label,
+ PreferenceConstants.CODEASSIST_AUTOACTIVATION, 0);
+ label = PHPUIMessages
+ .getString("PHPEditorPreferencePage.autoActivationDelay"); //$NON-NLS-1$
+ fAutoInsertDelayText = addTextField(contentAssistComposite, label,
+ PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY, 4, 0, true);
+ label = PHPUIMessages
+ .getString("PHPEditorPreferencePage.autoActivationTriggersForPHP"); //$NON-NLS-1$
+ fAutoInsertJavaTriggerText = addTextField(contentAssistComposite, label,
+ PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA, 4, 0,
+ false);
+ label = PHPUIMessages
+ .getString("PHPEditorPreferencePage.autoActivationTriggersForPHPDoc"); //$NON-NLS-1$
+ fAutoInsertJavaDocTriggerText = addTextField(contentAssistComposite, label,
+ PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVADOC, 4, 0,
+ false);
+ label = PHPUIMessages
+ .getString("PHPEditorPreferencePage.autoActivationTriggersForHTML"); //$NON-NLS-1$
+ fAutoInsertHTMLTriggerText = addTextField(contentAssistComposite, label,
+ PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_HTML, 4, 0,
+ false);
+ label = PHPUIMessages
+ .getString("PHPEditorPreferencePage.backgroundForCompletionProposals"); //$NON-NLS-1$
+ addColorButton(contentAssistComposite, label,
+ PreferenceConstants.CODEASSIST_PROPOSALS_BACKGROUND, 0);
+ label = PHPUIMessages
+ .getString("PHPEditorPreferencePage.foregroundForCompletionProposals"); //$NON-NLS-1$
+ addColorButton(contentAssistComposite, label,
+ PreferenceConstants.CODEASSIST_PROPOSALS_FOREGROUND, 0);
+ // label =
+ // PHPUIMessages.getString("PHPEditorPreferencePage.backgroundForMethodParameters");
+ // //$NON-NLS-1$
+ // addColorButton(contentAssistComposite, label,
+ // PreferenceConstants.CODEASSIST_PARAMETERS_BACKGROUND, 0);
//
- // label = PHPUIMessages.getString("PHPEditorPreferencePage.foregroundForMethodParameters"); //$NON-NLS-1$
- // addColorButton(contentAssistComposite, label, PreferenceConstants.CODEASSIST_PARAMETERS_FOREGROUND, 0);
-
- // label = PHPUIMessages.getString("PHPEditorPreferencePage.backgroundForCompletionReplacement"); //$NON-NLS-1$
- // addColorButton(contentAssistComposite, label, PreferenceConstants.CODEASSIST_REPLACEMENT_BACKGROUND, 0);
+ // label =
+ // PHPUIMessages.getString("PHPEditorPreferencePage.foregroundForMethodParameters");
+ // //$NON-NLS-1$
+ // addColorButton(contentAssistComposite, label,
+ // PreferenceConstants.CODEASSIST_PARAMETERS_FOREGROUND, 0);
+ // label =
+ // PHPUIMessages.getString("PHPEditorPreferencePage.backgroundForCompletionReplacement");
+ // //$NON-NLS-1$
+ // addColorButton(contentAssistComposite, label,
+ // PreferenceConstants.CODEASSIST_REPLACEMENT_BACKGROUND, 0);
//
- // label = PHPUIMessages.getString("PHPEditorPreferencePage.foregroundForCompletionReplacement"); //$NON-NLS-1$
- // addColorButton(contentAssistComposite, label, PreferenceConstants.CODEASSIST_REPLACEMENT_FOREGROUND, 0);
-
+ // label =
+ // PHPUIMessages.getString("PHPEditorPreferencePage.foregroundForCompletionReplacement");
+ // //$NON-NLS-1$
+ // addColorButton(contentAssistComposite, label,
+ // PreferenceConstants.CODEASSIST_REPLACEMENT_FOREGROUND, 0);
autoactivation.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
updateAutoactivationControls();
});
return contentAssistComposite;
}
-
/*
* @see PreferencePage#createContents(Composite)
*/
protected Control createContents(Composite parent) {
-
fOverlayStore.load();
fOverlayStore.start();
-
TabFolder folder = new TabFolder(parent, SWT.NONE);
folder.setLayout(new TabFolderLayout());
folder.setLayoutData(new GridData(GridData.FILL_BOTH));
-
TabItem item = new TabItem(folder, SWT.NONE);
item.setText(PHPUIMessages.getString("PHPEditorPreferencePage.general")); //$NON-NLS-1$
item.setControl(createAppearancePage(folder));
-
item = new TabItem(folder, SWT.NONE);
item.setText(PHPUIMessages.getString("PHPEditorPreferencePage.colors")); //$NON-NLS-1$
item.setControl(createSyntaxPage(folder));
-
item = new TabItem(folder, SWT.NONE);
item.setText(PHPUIMessages.getString("PHPEditorPreferencePage.codeAssist")); //$NON-NLS-1$
item.setControl(createContentAssistPage(folder));
-
item = new TabItem(folder, SWT.NONE);
- item.setText(PHPUIMessages.getString("PHPEditorPreferencePage.problemIndicationTab.title")); //$NON-NLS-1$
- item.setControl(createProblemIndicationPage(folder));
-
+ item.setText(PHPUIMessages
+ .getString("PHPEditorPreferencePage.annotationsTab.title")); //$NON-NLS-1$
+ item.setControl(createAnnotationsPage(folder));
item = new TabItem(folder, SWT.NONE);
- item.setText(PHPUIMessages.getString("PHPEditorPreferencePage.behaviourTab.title")); //$NON-NLS-1$
+ item.setText(PHPUIMessages
+ .getString("PHPEditorPreferencePage.behaviourTab.title")); //$NON-NLS-1$
item.setControl(createBehaviourPage(folder));
-
// item= new TabItem(folder, SWT.NONE);
- // item.setText(PHPUIMessages.getString("PHPEditorPreferencePage.hoverTab.title")); //$NON-NLS-1$
- // fJavaEditorHoverConfigurationBlock= new JavaEditorHoverConfigurationBlock(fOverlayStore);
+ // item.setText(PHPUIMessages.getString("PHPEditorPreferencePage.hoverTab.title"));
+ // //$NON-NLS-1$
+ // fJavaEditorHoverConfigurationBlock= new
+ // JavaEditorHoverConfigurationBlock(fOverlayStore);
// item.setControl(fJavaEditorHoverConfigurationBlock.createControl(folder));
-
initialize();
-
return folder;
}
-
private void initialize() {
-
fFontEditor.setPreferenceStore(getPreferenceStore());
fFontEditor.setPreferencePage(this);
fFontEditor.load();
-
initializeFields();
-
for (int i = 0; i < fSyntaxColorListModel.length; i++)
fSyntaxColorList.add(fSyntaxColorListModel[i][0]);
-
fSyntaxColorList.getDisplay().asyncExec(new Runnable() {
public void run() {
if (fSyntaxColorList != null && !fSyntaxColorList.isDisposed()) {
}
}
});
-
for (int i = 0; i < fAppearanceColorListModel.length; i++)
fAppearanceColorList.add(fAppearanceColorListModel[i][0]);
-
fAppearanceColorList.getDisplay().asyncExec(new Runnable() {
public void run() {
if (fAppearanceColorList != null && !fAppearanceColorList.isDisposed()) {
}
}
});
-
- for (int i = 0; i < fProblemIndicationColorListModel.length; i++)
- fProblemIndicationList.add(fProblemIndicationColorListModel[i][0]);
-
- fProblemIndicationList.getDisplay().asyncExec(new Runnable() {
+ for (int i = 0; i < fAnnotationColorListModel.length; i++)
+ fAnnotationList.add(fAnnotationColorListModel[i][0]);
+ fAnnotationList.getDisplay().asyncExec(new Runnable() {
public void run() {
- if (fProblemIndicationList != null && !fProblemIndicationList.isDisposed()) {
- fProblemIndicationList.select(0);
- handleProblemIndicationColorListSelection();
+ if (fAnnotationList != null && !fAnnotationList.isDisposed()) {
+ fAnnotationList.select(0);
+ handleAnnotationListSelection();
}
}
});
+ // for (int i= 0; i < fContentAssistColorListModel.length; i++)
+ // fContentAssistColorList.add(fContentAssistColorListModel[i][0]);
+ // fContentAssistColorList.getDisplay().asyncExec(new Runnable() {
+ // public void run() {
+ // if (fContentAssistColorList != null &&
+ // !fContentAssistColorList.isDisposed()) {
+ // fContentAssistColorList.select(0);
+ // handleContentAssistColorListSelection();
+ // }
+ // }
+ // });
}
-
private void initializeFields() {
-
Iterator e = fColorButtons.keySet().iterator();
while (e.hasNext()) {
ColorEditor c = (ColorEditor) e.next();
RGB rgb = PreferenceConverter.getColor(fOverlayStore, key);
c.setColorValue(rgb);
}
-
e = fCheckBoxes.keySet().iterator();
while (e.hasNext()) {
Button b = (Button) e.next();
String key = (String) fCheckBoxes.get(b);
b.setSelection(fOverlayStore.getBoolean(key));
}
-
e = fTextFields.keySet().iterator();
while (e.hasNext()) {
Text t = (Text) e.next();
String key = (String) fTextFields.get(t);
t.setText(fOverlayStore.getString(key));
}
-
- RGB rgb = PreferenceConverter.getColor(fOverlayStore, PreferenceConstants.EDITOR_BACKGROUND_COLOR);
+ RGB rgb = PreferenceConverter.getColor(fOverlayStore,
+ PreferenceConstants.EDITOR_BACKGROUND_COLOR);
fBackgroundColorEditor.setColorValue(rgb);
-
- boolean default_ = fOverlayStore.getBoolean(PreferenceConstants.EDITOR_BACKGROUND_DEFAULT_COLOR);
+ boolean default_ = fOverlayStore
+ .getBoolean(PreferenceConstants.EDITOR_BACKGROUND_DEFAULT_COLOR);
fBackgroundDefaultRadioButton.setSelection(default_);
fBackgroundCustomRadioButton.setSelection(!default_);
fBackgroundColorButton.setEnabled(!default_);
-
- // boolean closeJavaDocs= fOverlayStore.getBoolean(PreferenceConstants.EDITOR_CLOSE_JAVADOCS);
+ // boolean closeJavaDocs=
+ // fOverlayStore.getBoolean(PreferenceConstants.EDITOR_CLOSE_JAVADOCS);
// fAddJavaDocTagsButton.setEnabled(closeJavaDocs);
-
- // boolean fillMethodArguments = fOverlayStore.getBoolean(PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES);
+ // boolean fillMethodArguments =
+ // fOverlayStore.getBoolean(PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES);
// fGuessMethodArgumentsButton.setEnabled(fillMethodArguments);
-
updateAutoactivationControls();
-
// fJavaEditorHoverConfigurationBlock.initializeFields();
}
-
private void updateAutoactivationControls() {
- boolean autoactivation = fOverlayStore.getBoolean(PreferenceConstants.CODEASSIST_AUTOACTIVATION);
+ boolean autoactivation = fOverlayStore
+ .getBoolean(PreferenceConstants.CODEASSIST_AUTOACTIVATION);
fAutoInsertDelayText.setEnabled(autoactivation);
fAutoInsertJavaTriggerText.setEnabled(autoactivation);
fAutoInsertJavaDocTriggerText.setEnabled(autoactivation);
fAutoInsertHTMLTriggerText.setEnabled(autoactivation);
}
-
/*
* @see PreferencePage#performOk()
*/
PHPeclipsePlugin.getDefault().savePluginPreferences();
return true;
}
-
/*
* @see PreferencePage#performDefaults()
*/
protected void performDefaults() {
-
fFontEditor.loadDefault();
-
fOverlayStore.loadDefaults();
initializeFields();
-
// fUserDefinedPHPSyntaxFileFFE.loadDefault();
handleSyntaxColorListSelection();
handleAppearanceColorListSelection();
- handleProblemIndicationColorListSelection();
+ handleAnnotationListSelection();
+ // handleContentAssistColorListSelection();
super.performDefaults();
-
fPreviewViewer.invalidateTextPresentation();
}
-
/*
* @see DialogPage#dispose()
*/
public void dispose() {
-
if (fJavaTextTools != null) {
fJavaTextTools = null;
}
-
fFontEditor.setPreferencePage(null);
fFontEditor.setPreferenceStore(null);
-
if (fOverlayStore != null) {
fOverlayStore.stop();
fOverlayStore = null;
}
-
super.dispose();
}
-
- private Control addColorButton(Composite composite, String label, String key, int indentation) {
-
+ private Control addColorButton(Composite composite, String label, String key,
+ int indentation) {
Label labelControl = new Label(composite, SWT.NONE);
labelControl.setText(label);
-
GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gd.horizontalIndent = indentation;
labelControl.setLayoutData(gd);
-
ColorEditor editor = new ColorEditor(composite);
Button button = editor.getButton();
button.setData(editor);
-
gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
button.setLayoutData(gd);
button.addSelectionListener(fColorButtonListener);
-
fColorButtons.put(editor, key);
-
return composite;
}
-
- private Button addCheckBox(Composite parent, String label, String key, int indentation) {
+ private void addFiller(Composite composite) {
+ Label filler = new Label(composite, SWT.LEFT);
+ GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ gd.horizontalSpan = 2;
+ gd.heightHint = convertHeightInCharsToPixels(1) / 2;
+ filler.setLayoutData(gd);
+ }
+ private Button addCheckBox(Composite parent, String label, String key,
+ int indentation) {
Button checkBox = new Button(parent, SWT.CHECK);
checkBox.setText(label);
-
GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gd.horizontalIndent = indentation;
gd.horizontalSpan = 2;
checkBox.setLayoutData(gd);
checkBox.addSelectionListener(fCheckBoxListener);
-
fCheckBoxes.put(checkBox, key);
-
return checkBox;
}
-
- private Control addTextField(Composite composite, String label, String key, int textLimit, int indentation, boolean isNumber) {
-
+ private Control addTextField(Composite composite, String label, String key,
+ int textLimit, int indentation, boolean isNumber) {
Label labelControl = new Label(composite, SWT.NONE);
labelControl.setText(label);
GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gd.horizontalIndent = indentation;
labelControl.setLayoutData(gd);
-
Text textControl = new Text(composite, SWT.BORDER | SWT.SINGLE);
gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gd.widthHint = convertWidthInCharsToPixels(textLimit + 1);
} else {
textControl.addModifyListener(fTextFieldListener);
}
-
return textControl;
}
-
private void addTextFontEditor(Composite parent, String label, String key) {
-
Composite editorComposite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 3;
editorComposite.setLayout(layout);
- fFontEditor = new WorkbenchChainedTextFontFieldEditor(key, label, editorComposite);
- fFontEditor.setChangeButtonText(PHPUIMessages.getString("PHPEditorPreferencePage.change")); //$NON-NLS-1$
-
+ fFontEditor = new WorkbenchChainedTextFontFieldEditor(key, label,
+ editorComposite);
+ fFontEditor.setChangeButtonText(PHPUIMessages
+ .getString("PHPEditorPreferencePage.change")); //$NON-NLS-1$
GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gd.horizontalSpan = 2;
editorComposite.setLayoutData(gd);
}
-
private String loadPreviewContentFromFile(String filename) {
String line;
String separator = System.getProperty("line.separator"); //$NON-NLS-1$
StringBuffer buffer = new StringBuffer(512);
BufferedReader reader = null;
try {
- reader = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream(filename)));
+ reader = new BufferedReader(new InputStreamReader(getClass()
+ .getResourceAsStream(filename)));
while ((line = reader.readLine()) != null) {
buffer.append(line);
buffer.append(separator);
}
return buffer.toString();
}
-
private void numberFieldChanged(Text textControl) {
String number = textControl.getText();
IStatus status = validatePositiveNumber(number);
fOverlayStore.setValue((String) fTextFields.get(textControl), number);
updateStatus(status);
}
-
private IStatus validatePositiveNumber(String number) {
StatusInfo status = new StatusInfo();
if (number.length() == 0) {
- status.setError(PHPUIMessages.getString("PHPEditorPreferencePage.empty_input")); //$NON-NLS-1$
+ status.setError(PHPUIMessages
+ .getString("PHPEditorPreferencePage.empty_input")); //$NON-NLS-1$
} else {
try {
int value = Integer.parseInt(number);
if (value < 0)
- status.setError(PHPUIMessages.getFormattedString("PHPEditorPreferencePage.invalid_input", number)); //$NON-NLS-1$
+ status.setError(PHPUIMessages.getFormattedString(
+ "PHPEditorPreferencePage.invalid_input", number)); //$NON-NLS-1$
} catch (NumberFormatException e) {
- status.setError(PHPUIMessages.getFormattedString("PHPEditorPreferencePage.invalid_input", number)); //$NON-NLS-1$
+ status.setError(PHPUIMessages.getFormattedString(
+ "PHPEditorPreferencePage.invalid_input", number)); //$NON-NLS-1$
}
}
return status;
}
-
private void updateStatus(IStatus status) {
if (!status.matches(IStatus.ERROR)) {
for (int i = 0; i < fNumberFields.size(); i++) {
setValid(!status.matches(IStatus.ERROR));
StatusUtil.applyToStatusLine(this, status);
}
-
/**
* @deprecated Inline to avoid reference to preference page
*/
public static boolean indicateQuixFixableProblems() {
- return PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_CORRECTION_INDICATION);
+ return PreferenceConstants.getPreferenceStore().getBoolean(
+ PreferenceConstants.EDITOR_CORRECTION_INDICATION);
}
-
/**
* @deprecated Inline to avoid reference to preference page
*/
// static public boolean synchronizeOutlineOnCursorMove() {
- // return PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE);
+ // return
+ // PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE);
// }
-
}
\ No newline at end of file
public class PreferencesMessages {
- private static final String RESOURCE_BUNDLE= "org.eclipse.jdt.internal.ui.preferences.PreferencesMessages";//$NON-NLS-1$
+ private static final String RESOURCE_BUNDLE= "net.sourceforge.phpdt.internal.ui.preferences.PreferencesMessages";//$NON-NLS-1$
private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
ImportOrganizePreferencePage.order.label=Define the &sorting order of import statements. A package name prefix (e.g. org.eclipse) is a valid entry.
-ImportOrganizePreferencePage.order.add.button=&New..
+ImportOrganizePreferencePage.order.add.button=&New...
ImportOrganizePreferencePage.order.edit.button=&Edit...
ImportOrganizePreferencePage.order.up.button=&Up
ImportOrganizePreferencePage.order.down.button=Do&wn
JavaBasePreferencePage.updateJavaViews=Update Java views
JavaBasePreferencePage.onSave=On &save only
JavaBasePreferencePage.whileEditing=While &editing
-JavaBasePreferencePage.notice.outliner=Note: This preference is not applied to already opened views (Outline view is always updated while editing)
+JavaBasePreferencePage.note=Note:
+JavaBasePreferencePage.notice.outliner=This preference is not applied to already opened views\n(Outline view is always updated while editing)
JavaBasePreferencePage.openTypeHierarchy=When opening a Type Hierarchy
JavaBasePreferencePage.inPerspective=Open a new Type Hierarchy &Perspective
JavaEditorPreferencePage.annotations.tasks= Tasks
JavaEditorPreferencePage.annotations.others= Others
JavaEditorPreferencePage.annotations.showInText= Show in &text
+TextEditorPreferencePage.annotations.highlightInText= &Highlight in text
JavaEditorPreferencePage.annotations.showInOverviewRuler= Show in overview &ruler
+JavaEditorPreferencePage.annotations.showInVerticalRuler= Show in vertical r&uler
JavaEditorPreferencePage.annotations.color= C&olor:
JavaEditorPreferencePage.multiLineComment=Multi-line comment
JavaEditorPreferencePage.singleLineComment=Single-line comment
JavaEditorPreferencePage.keywords=Keywords
JavaEditorPreferencePage.strings=Strings
JavaEditorPreferencePage.others=Others
+JavaEditorPreferencePage.methodNames=Method names
+JavaEditorPreferencePage.operators=Operators and brackets
JavaEditorPreferencePage.javaCommentTaskTags=Task Tags
JavaEditorPreferencePage.javaDocKeywords=Javadoc keywords
JavaEditorPreferencePage.javaDocHtmlTags=Javadoc HTML tags
JavaEditorPreferencePage.bold=&Bold
JavaEditorPreferencePage.preview=Preview:
JavaEditorPreferencePage.displayedTabWidth=Displayed &tab width:
-JavaEditorPreferencePage.insertSpaceForTabs=Ins&ert space for tabs (see Code Formatter preference page)
+JavaEditorPreferencePage.insertSpaceForTabs=Ins&ert spaces for tab (see Code Formatter preference page)
JavaEditorPreferencePage.showOverviewRuler=Show overview &ruler
JavaEditorPreferencePage.highlightMatchingBrackets=Highlight &matching brackets
JavaEditorPreferencePage.highlightCurrentLine=Hi&ghlight current line
JavaEditorPreferencePage.showPrintMargin=Sho&w print margin
JavaEditorPreferencePage.printMarginColumn=Print margin col&umn:
JavaEditorPreferencePage.insertSingleProposalsAutomatically=Insert single &proposals automatically
-JavaEditorPreferencePage.showOnlyProposalsVisibleInTheInvocationContext=Show only proposals &visible in the invocation context
+JavaEditorPreferencePage.showOnlyProposalsVisibleInTheInvocationContext=S&how only proposals visible in the invocation context
JavaEditorPreferencePage.presentProposalsInAlphabeticalOrder=Present proposals in a&lphabetical order
JavaEditorPreferencePage.enableAutoActivation=&Enable auto activation
JavaEditorPreferencePage.automaticallyAddImportInsteadOfQualifiedName=Automatically add import instead of &qualified name
JavaEditorPreferencePage.completionOverwrites=Completion over&writes
JavaEditorPreferencePage.fillArgumentNamesOnMethodCompletion=&Fill argument names on method completion
JavaEditorPreferencePage.guessArgumentNamesOnMethodCompletion=&Guess filled argument names
-JavaEditorPreferencePage.autoActivationDelay=Auto activation dela&y:
+JavaEditorPreferencePage.autoActivationDelay=A&uto activation delay:
JavaEditorPreferencePage.autoActivationTriggersForJava=Auto activation &triggers for Java:
JavaEditorPreferencePage.autoActivationTriggersForJavaDoc=Auto activation triggers for &Javadoc:
JavaEditorPreferencePage.currentLineHighlighColor=Current line highlight
JavaEditorPreferencePage.printMarginColor2=Print margin
JavaEditorPreferencePage.findScopeColor2=Find scope
-JavaEditorPreferencePage.linkedPositionColor2=Linked position
+JavaEditorPreferencePage.linkedPositionColor2=Linked focus position
+JavaEditorPreferencePage.linkedPositionSlaveColor2=Linked position
+JavaEditorPreferencePage.linkedPositionTargetColor2=Linked target position
+JavaEditorPreferencePage.linkedPositionExitColor2=Linked exit position
JavaEditorPreferencePage.linkColor2=Link
-JavaEditorPreferencePage.synchronizeOnCursor=Synchroni&ze outline selection on cursor move (editor must be reopened)
+JavaEditorPreferencePage.synchronizeOnCursor=Synchroni&ze outline selection and range indication on caret move
JavaEditorPreferencePage.appearanceOptions=Appearance co&lor options:
JavaEditorPreferencePage.typing.tabTitle= T&yping
JavaEditorPreferencePage.closeBrackets= Close &brackets and parenthesis
JavaEditorPreferencePage.closeBraces= Cl&ose braces
JavaEditorPreferencePage.closeJavaDocs= Close Java&docs and comments
-JavaEditorPreferencePage.wrapStrings= &Wrap Java strings
+JavaEditorPreferencePage.wrapStrings= Wra&p Java strings
+JavaEditorPreferencePage.escapeStrings= &Escape text when pasting into a string literal
JavaEditorPreferencePage.addJavaDocTags= Add Javadoc &tags
JavaEditorPreferencePage.smartPaste= Pasting fo&r correct indentation
JavaEditorPreferencePage.smartHomeEnd= S&mart cursor positioning at line start and end
+JavaEditorPreferencePage.subWordNavigation= Smart cursor positioning in &Java names
+JavaEditorPreferencePage.overwriteMode= Disable over&write typing mode in Java editors
JavaEditorPreferencePage.hoverTab.title= Ho&vers
JavaEditorPreferencePage.navigation.insertModifierAndDelimiter= \ {0} +
JavaEditorPreferencePage.navigation.insertDelimiterAndModifier= \ + {0}
+JavaEditorPreferencePage.markOccurrences= Mar&k occurrences in file
+JavaEditorPreferencePage.stickyOccurrences= S&ticky
+
JavaEditorHoverConfigurationBlock.hoverPreferences= &Hover key modifier preferences:
JavaEditorHoverConfigurationBlock.enabled= &Enabled
JavaEditorHoverConfigurationBlock.keyModifier= Key &Modifier:
JavaEditorHoverConfigurationBlock.insertModifierAndDelimiter= \ {0} +
JavaEditorHoverConfigurationBlock.insertDelimiterAndModifier= \ + {0}
+JavaEditorHoverConfigurationBlock.showAffordance= Show affordance in hover on how to make it sticky
+
JavaElementInfoPage.binary=binary
JavaElementInfoPage.classpath_entry_kind=Classpath entry kind:
JavaElementInfoPage.library=library
JavaElementInfoPage.variable_path=Variable path:
JavaElementInfoPage.location=Location:
-JavadocConfigurationPropertyPage.IsPackageFragmentRoot.description=Specify the location (URL) of the documentation generated by Javadoc. The Javadoc location will contain a file called 'package-list'. For example: \'http://www.sample-url.org/doc/\'
+JavadocConfigurationPropertyPage.IsPackageFragmentRoot.description=Specify the location (URL) of the documentation generated by Javadoc. The Javadoc location will contain a file called 'package-list'.
JavadocConfigurationPropertyPage.IsIncorrectElement.description=Javadoc location can only be attached to Java projects or JAR files in Java projects
-JavadocConfigurationPropertyPage.IsJavaProject.description=Specify the location (URL) of the project\'s Javadoc documentation. This location is used by the Javadoc export wizard as default value and by the \'Open External Javadoc\' action. For example: \'file://c:/myworkspace/myproject/doc/\'.
-
-JavadocConfigurationBlock.location.label=Javadoc &location:
-JavadocConfigurationBlock.location.button=Bro&wse...
+JavadocConfigurationPropertyPage.IsJavaProject.description=Specify the location of the project\'s Javadoc documentation. This location is used by the Javadoc export wizard as the default value and by the \'Open External Javadoc\' action. For example: \'c:/myworkspace/myproject/doc\'.
+JavadocConfigurationBlock.browse.button=&Browse...
JavadocConfigurationBlock.error.notafolder=Location does not exist.
JavadocConfigurationBlock.warning.packagelistnotfound=Location does not contain file 'package-list'.
-
-JavadocConfigurationBlock.javadocLocationDialog.label=Javadoc Location Selection
-JavadocConfigurationBlock.javadocLocationDialog.message=&Select Javadoc location:
-
+JavadocConfigurationBlock.javadocFolderDialog.label=Javadoc Location Selection
+JavadocConfigurationBlock.javadocFolderDialog.message=Select Javadoc location:
+JavadocConfigurationBlock.javadocArchiveDialog.label=Javadoc Archive Selection
JavadocConfigurationBlock.MalformedURL.error=Invalid URL
-
-JavadocConfigurationBlock.ValidateButton.label=&Validate...
+JavadocConfigurationBlock.validate.button=&Validate...
JavadocConfigurationBlock.InvalidLocation.message= Location is invalid. Location contains neither the file \'package-list\' nor \'index.html'.
JavadocConfigurationBlock.ValidLocation.message= Location is valid. Files \'package-list\' and \'index.html\' found. Click OK to open in browser.
JavadocConfigurationBlock.UnableToValidateLocation.message=Unable to validate location
JavadocConfigurationBlock.MessageDialog.title=Validating Javadoc Location
+JavadocConfigurationBlock.location.type.path.label=Javadoc URL (e.g. \'http://www.sample-url.org/doc/\' or 'file:/c:/myworkspace/myproject/doc\')
+JavadocConfigurationBlock.location.type.jar.label=Javadoc in archive
+JavadocConfigurationBlock.location.path.label=Javadoc &location path:
+JavadocConfigurationBlock.location.jar.label=Archive &path:
+JavadocConfigurationBlock.jar.path.label=Path &within archive:
+JavadocConfigurationBlock.zipImportSource.title=Javadoc Archive Selection
+JavadocConfigurationBlock.location_in_jarorzip.message=&Select the folder that is the root of the Javadoc documentation:
+JavadocConfigurationBlock.browse_jarorzip_path.title=Javadoc Root Location
+JavadocConfigurationBlock.error.notafile=Archive does not exist
JavadocPreferencePage.description=Specify the location of the Javadoc command to be used by the Javadoc export wizard. Location must be an absolute path.
JavadocPreferencePage.command.label=&Javadoc command:
-JavadocPreferencePage.command.button=Bro&wse...
+JavadocPreferencePage.command.button=&Browse...
JavadocPreferencePage.error.notexists=Javadoc command does not exist
+JavadocPreferencePage.info.notset=Set to enable Javadoc generation tool.
JavadocPreferencePage.browsedialog.title=Javadoc Command Selection
-MembersOrderPreferencePage.button.up=U&p
-MembersOrderPreferencePage.button.down=Do&wn
-MembersOrderPreferencePage.label.description=&Choose the order in which members will be displayed. The order is also used by the 'Sort Members' action.
SourceAttachmentPropertyPage.error.title=Error Attaching Source
SourceAttachmentPropertyPage.error.message=An error occurred while associating the source
AppearancePreferencePage.pkgNamePattern.label= Com&pression pattern (e.g. given package name 'org.eclipse.jdt' pattern '.' will compress it to '..jdt', '0' to 'jdt', '1~.' to 'o~.e~.jdt'):
AppearancePreferencePage.showMembersInPackagesView=S&how members in Package Explorer
AppearancePreferencePage.stackViewsVerticallyInTheJavaBrowsingPerspective=&Stack views vertically in the Java Browsing perspective
-AppearancePreferencePage.preferenceOnlyEffectiveForNewPerspectives=Note: This preference will only take effect on new perspectives
+AppearancePreferencePage.note=Note:
+AppearancePreferencePage.preferenceOnlyEffectiveForNewPerspectives=This preference will only take effect on new perspectives
AppearancePreferencePage.packageNameCompressionPattern.error.isEmpty=Enter a package name compression pattern
AppearancePreferencePage.foldEmptyPackages= &Fold empty packages in hierarchical Package Explorer layout
CodeFormatterPreferencePage.title=Code Formatter
-CodeFormatterPreferencePage.description=Options for the Java Code Formatter:
+CodeFormatterPreferencePage.description=Sele&ct a profile:
CodeFormatterPreferencePage.empty_input=Empty input
CodeFormatterPreferencePage.invalid_input=''{0}'' is not a valid input.
CodeFormatterPreferencePage.newline_clear_lines=Clear all &blank lines
CodeFormatterPreferencePage.newline_else_if.label=&Insert new line between 'else if'
CodeFormatterPreferencePage.newline_empty_block.label=In&sert a new line inside an empty block
-CodeFormatterPreferencePage.split_line.label=Ma&ximum line length:
+CodeFormatterPreferencePage.split_code.label=Ma&ximum code line length:
+CodeFormatterPreferencePage.split_comment.label=Maxi&mum comment line length:
CodeFormatterPreferencePage.style_compact_assignement.label=&Compact assignment
CodeFormatterPreferencePage.style_space_castexpression.label=Insert sp&ace after a cast
CodeFormatterPreferencePage.tab_char.label=Insert &tabs for indentation, not spaces
CodeFormatterPreferencePage.tab_size.label=&Number of spaces representing an indentation level:
+CodeFormatterPreferencePage.comment_format.label=&Format comments
+CodeFormatterPreferencePage.comment_formathtml.label=Format HTML &tags
+CodeFormatterPreferencePage.comment_formatsource.label=Format Java code &snippets
+CodeFormatterPreferencePage.comment_indentroottags.label=&Indent Javadoc tags
+CodeFormatterPreferencePage.comment_newlineparam.label=&New line after Javadoc tag parameters
+CodeFormatterPreferencePage.comment_separateroottags.label=&Empty line before Javadoc tag block
+CodeFormatterPreferencePage.comment_formatheader.label=Format &header comment
+CodeFormatterPreferencePage.comment_indentparamdesc.label= Indent Javadoc parameter &descriptions
CodeFormatterPreferencePage.tab.newline.tabtitle=Ne&w Lines
-CodeFormatterPreferencePage.tab.linesplit.tabtitle=Line S&plitting
+CodeFormatterPreferencePage.tab.linesplit.tabtitle=Line Len>h
CodeFormatterPreferencePage.tab.style.tabtitle=St&yle
+CodeFormatterPreferencePage.tab.comment.tabtitle=&Comments
TodoTaskPreferencePage.title=Task Tags
TodoTaskConfigurationBlock.markers.tasks.normal.priority=Normal
TodoTaskConfigurationBlock.markers.tasks.low.priority=Low
TodoTaskConfigurationBlock.markers.tasks.label=&Strings indicating tasks in Java comments:
-TodoTaskConfigurationBlock.markers.tasks.add.button=Ne&w...
-TodoTaskConfigurationBlock.markers.tasks.remove.button=Remo&ve
-TodoTaskConfigurationBlock.markers.tasks.edit.button=Edi&t...
+TodoTaskConfigurationBlock.markers.tasks.add.button=&New...
+TodoTaskConfigurationBlock.markers.tasks.remove.button=&Remove
+TodoTaskConfigurationBlock.markers.tasks.edit.button=&Edit...
TodoTaskConfigurationBlock.markers.tasks.name.column=Tag
TodoTaskConfigurationBlock.markers.tasks.priority.column=Priority
CompilerPropertyPage.useworkspacesettings.change=&Configure Workspace Settings...
CompilerPropertyPage.useprojectsettings.label=Use pr&oject settings
-CompilerConfigurationBlock.style.tabtitle=&Style
-CompilerConfigurationBlock.problems.tabtitle=&Problems
+CompilerConfigurationBlock.advanced.tabtitle=Ad&vanced
+CompilerConfigurationBlock.unused.tabtitle=&Unused Code
+CompilerConfigurationBlock.common.tabtitle=&Style
CompilerConfigurationBlock.compliance.tabtitle=&Compliance and Classfiles
-CompilerConfigurationBlock.others.tabtitle=&Build Path
+CompilerConfigurationBlock.others.tabtitle=Build &Path
+CompilerConfigurationBlock.javadoc.tabtitle=&Javadoc
-CompilerConfigurationBlock.style.description=Select the severity level for the following problems:
-CompilerConfigurationBlock.problems.description=Select the severity level for the following problems:
+CompilerConfigurationBlock.common.description=Select the severity level for the following problems:
+CompilerConfigurationBlock.unused.description=Select the severity level for the following problems:
+CompilerConfigurationBlock.advanced.description=Select the severity level for the following problems:
CompilerConfigurationBlock.build_warnings.description=Select the severity level for the following build path problems:
-CompilerConfigurationBlock.variable_attr.label=Add &variable attributes to generated class files (used by the debugger)
+CompilerConfigurationBlock.variable_attr.label=Add varia&ble attributes to generated class files (used by the debugger)
CompilerConfigurationBlock.line_number_attr.label=Add &line number attributes to generated class files (used by the debugger)
CompilerConfigurationBlock.source_file_attr.label=Add source &file name to generated class file (used by the debugger)
-CompilerConfigurationBlock.codegen_unused_local.label=Pr&eserve unused local variables (i.e. never read)
+CompilerConfigurationBlock.codegen_unused_local.label=Pr&eserve unused local variables (never read)
-CompilerConfigurationBlock.compiler_compliance.label=C&ompiler compliance level:
-CompilerConfigurationBlock.default_settings.label=&Use default compliance settings
+CompilerConfigurationBlock.compiler_compliance.label=Comp&iler compliance level:
+CompilerConfigurationBlock.default_settings.label=Use defaul&t compliance settings
CompilerConfigurationBlock.source_compatibility.label=Source co&mpatibility:
CompilerConfigurationBlock.codegen_targetplatform.label=Ge&nerated .class files compatibility:
-CompilerConfigurationBlock.pb_assert_as_identifier.label=&Report 'assert' as identifier:
+CompilerConfigurationBlock.pb_assert_as_identifier.label=Disallow identifie&rs called 'assert':
CompilerConfigurationBlock.compliance.group.label=JDK Compliance
CompilerConfigurationBlock.classfiles.group.label=Classfile Generation
CompilerConfigurationBlock.pb_overriding_pkg_dflt.label=&Methods overridden but not package visible:
CompilerConfigurationBlock.pb_method_naming.label=Me&thods with a constructor name:
CompilerConfigurationBlock.pb_no_effect_assignment.label=Assignment has no &effect (e.g. 'x = x'):
-CompilerConfigurationBlock.pb_incompatible_interface_method.label=Conflict of interface method &with protected 'Object' method:
+CompilerConfigurationBlock.pb_incompatible_interface_method.label=Conflict of &interface method with protected 'Object' method:
+CompilerConfigurationBlock.pb_indirect_access_to_static.label=Indi&rect access to static member:
CompilerConfigurationBlock.pb_hidden_catchblock.label=&Hidden catch blocks:
-CompilerConfigurationBlock.pb_static_access_receiver.label=Non-stat&ic access to static member
+CompilerConfigurationBlock.pb_static_access_receiver.label=Non-stat&ic access to static member:
CompilerConfigurationBlock.pb_unused_imports.label=Unus&ed imports:
-CompilerConfigurationBlock.pb_unused_local.label=Unused &local variables (i.e. never read):
-CompilerConfigurationBlock.pb_unused_parameter.label=U&nused parameters (i.e. never read):
-CompilerConfigurationBlock.pb_unused_private.label=Unused private &types, methods or fields:
+CompilerConfigurationBlock.pb_unused_local.label=&Local variable is never read:
+CompilerConfigurationBlock.pb_unused_parameter.label=Parameter is &never read:
+CompilerConfigurationBlock.pb_signal_param_in_overriding.label=Chec&k overriding and implementing methods
+
+CompilerConfigurationBlock.pb_unused_private.label=Unused or unread priva&te members:
CompilerConfigurationBlock.pb_non_externalized_strings.label=Usage of non-e&xternalized strings:
CompilerConfigurationBlock.pb_deprecation.label=Usa&ge of deprecated API:
-CompilerConfigurationBlock.pb_deprecation_in_deprecation.label=Signal use &of deprecated API inside deprecated code.
+CompilerConfigurationBlock.pb_deprecation_in_deprecation.label=Signal use o&f deprecated API inside deprecated code.
+CompilerConfigurationBlock.pb_deprecation_when_overriding.label=Check ove&rriding and implementing methods
+CompilerConfigurationBlock.pb_superfluous_semicolon.label=Unnecessary se&micolon:
+CompilerConfigurationBlock.pb_unnecessary_type_check.label=Unnecessary cast or '&instanceof' operation:
CompilerConfigurationBlock.pb_synth_access_emul.label=Access to a &non-accessible member of an enclosing type:
-CompilerConfigurationBlock.pb_char_array_in_concat.label=&Using a char array in string concatenation:
+CompilerConfigurationBlock.pb_char_array_in_concat.label=Using a c&har array in string concatenation:
CompilerConfigurationBlock.pb_incomplete_build_path.label=&Incomplete build path:
CompilerConfigurationBlock.pb_build_path_cycles.label=Circular d&ependencies:
-CompilerConfigurationBlock.pb_duplicate_resources.label=D&uplicated resources:
-CompilerConfigurationBlock.pb_max_per_unit.label=Ma&ximum number of problems reported per compilation unit:
-
+CompilerConfigurationBlock.pb_duplicate_resources.label=Duplica&ted resources:
+CompilerConfigurationBlock.pb_max_per_unit.label=&Maximum number of problems reported per compilation unit:
+CompilerConfigurationBlock.pb_check_prereq_binary_level.label=Incompatible required &binaries:
+
+CompilerConfigurationBlock.pb_accidential_assignement.label=Possi&ble accidental boolean assignment (e.g. if (a = b)):
+CompilerConfigurationBlock.pb_local_variable_hiding.label=&Local variable declaration hides another field or variable:
+CompilerConfigurationBlock.pb_field_hiding.label=&Field declaration hides another field or variable:
+CompilerConfigurationBlock.pb_special_param_hiding.label=Include const&ructor or setter method parameters
+
+CompilerConfigurationBlock.pb_unqualified_field_access.label=Unqualified access to instance fi&eld:
+CompilerConfigurationBlock.pb_finally_block_not_completing.label='&finally' does not complete normally:
+CompilerConfigurationBlock.pb_undocumented_empty_block.label=U&ndocumented empty block:
+CompilerConfigurationBlock.pb_unused_throwing_exception.label=Unnecessary declaration of t&hrown checked exception:
+CompilerConfigurationBlock.pb_unused_throwing_exception_when_overriding.label=Check &overriding and implementing methods
+
+CompilerConfigurationBlock.javadoc.description=Select the severity level for the following problems:
+CompilerConfigurationBlock.pb_invalid_javadoc.label=Mal&formed Javadoc comments:
+CompilerConfigurationBlock.pb_invalid_javadoc_tags.label=Report e&rrors in tags
+CompilerConfigurationBlock.pb_invalid_javadoc_tags_visibility.label=On&ly consider members as visible as:
+
+CompilerConfigurationBlock.pb_missing_javadoc.label=Missing Javadoc &tags:
+CompilerConfigurationBlock.pb_missing_javadoc_tags_visibility.label=O&nly consider members as visible as:
+CompilerConfigurationBlock.pb_missing_javadoc_tags_overriding.label=C&heck overriding and implementing methods
+
+CompilerConfigurationBlock.pb_missing_comments.label=&Missing Javadoc comments:
+CompilerConfigurationBlock.pb_missing_comments_visibility.label=&Only consider members as visible as:
+CompilerConfigurationBlock.pb_missing_comments_overriding.label=Ch&eck overriding and implementing methods
CompilerConfigurationBlock.resource_filter.description=Enter resources and resource types that should not be copied to the output folder during a build. List is comma separated (e.g. '*.doc, plugin.xml, scripts/')
-CompilerConfigurationBlock.resource_filter.label=Filtered &Resources:
-CompilerConfigurationBlock.build_invalid_classpath.label=Ab&ort building on build path errors
-CompilerConfigurationBlock.build_clean_outputfolder.label=Scrub output folders o&n full build
+CompilerConfigurationBlock.resource_filter.label=&Filtered Resources:
+CompilerConfigurationBlock.build_invalid_classpath.label=Abo&rt building on build path errors
+CompilerConfigurationBlock.build_clean_outputfolder.label=Clea&n output folders on full build
CompilerConfigurationBlock.enable_exclusion_patterns.label=Enable using e&xclusion patterns in source folders
CompilerConfigurationBlock.enable_multiple_outputlocations.label=Enable using &multiple output locations for source folders
CompilerConfigurationBlock.warning=Warning
CompilerConfigurationBlock.ignore=Ignore
+CompilerConfigurationBlock.public=Public
+CompilerConfigurationBlock.protected=Protected
+CompilerConfigurationBlock.default=Default
+CompilerConfigurationBlock.private=Private
+
+CompilerConfigurationBlock.enabled=Enabled
+CompilerConfigurationBlock.disabled=Disabled
+
CompilerConfigurationBlock.version11=1.1
CompilerConfigurationBlock.version12=1.2
CompilerConfigurationBlock.version13=1.3
NameConventionConfigurationBlock.static.label=Static Fields
NameConventionConfigurationBlock.arg.label=Parameters
NameConventionConfigurationBlock.local.label=Local Variables
+NameConventionConfigurationBlock.keywordthis.label=&Qualify all generated field accesses with 'this.'
+NameConventionConfigurationBlock.isforbooleangetters.label=&Use 'is' prefix for getters that return boolean.
NameConventionConfigurationBlock.dialog.prefix=P&refix list:
NameConventionConfigurationBlock.dialog.suffix=S&uffix list:
+NameConventionConfigurationBlock.exceptionname.label=E&xception variable name in catch blocks:
+
NameConventionConfigurationBlock.error.emptyprefix=Prefix strings can not contain an empty entry.
NameConventionConfigurationBlock.error.emptysuffix=Suffix strings can not contain an empty entry.
NameConventionConfigurationBlock.error.invalidprefix={0} is not a valid prefix.
NameConventionConfigurationBlock.local.dialog.title=Local Variable Name Conventions
NameConventionConfigurationBlock.local.dialog.message=Specify prefix and suffix to be used for local variables (comma separated):
+MembersOrderPreferencePage.category.button.up=&Up
+MembersOrderPreferencePage.category.button.down=D&own
+
+MembersOrderPreferencePage.visibility.button.up=U&p
+MembersOrderPreferencePage.visibility.button.down=Do&wn
+
+MembersOrderPreferencePage.label.description=&Choose the order in which members will be displayed. The order is also used by the 'Sort Members' action.
+
+
MembersOrderPreferencePage.fields.label=Fields
MembersOrderPreferencePage.constructors.label=Constructors
MembersOrderPreferencePage.methods.label=Methods
MembersOrderPreferencePage.staticinitialisers.label=Static Initializers
MembersOrderPreferencePage.types.label=Types
+MembersOrderPreferencePage.public.label=Public
+MembersOrderPreferencePage.private.label=Private
+MembersOrderPreferencePage.protected.label=Protected
+MembersOrderPreferencePage.default.label=Default
+
+MembersOrderPreferencePage.usevisibilitysort.label=&Sort members in same category by visibility
+
CodeTemplateBlock.templates.comment.node=Comments
CodeTemplateBlock.templates.code.node=Code
CodeTemplateBlock.constructorstub.label=Constructor body
CodeTemplateBlock.newtype.label=New Java files
CodeTemplateBlock.typecomment.label=Types
+CodeTemplateBlock.fieldcomment.label=Fields
CodeTemplateBlock.methodcomment.label=Methods
CodeTemplateBlock.overridecomment.label=Overriding methods
CodeTemplateBlock.constructorcomment.label=Constructors
+CodeTemplateBlock.gettercomment.label=Getters
+CodeTemplateBlock.settercomment.label=Setters
+CodeTemplateBlock.getterstub.label=Getter body
+CodeTemplateBlock.setterstub.label=Setter body
CodeTemplateBlock.templates.edit.button=&Edit...
CodeTemplateBlock.templates.import.button=&Import...
CodeTemplateBlock.export.error.hidden= Export failed.\n{0} is a hidden file.
CodeTemplateBlock.export.error.canNotWrite= Export failed.\n{0} can not be modified.
CodeTemplateBlock.export.error.fileNotFound= Export failed:\n{0}
+
+TypeFilterPreferencePage.description=All types in packages that match with the selected filter strings will not be shown in the 'Open Type' dialog and will also be ignored in code assist or quick fix proposals.
+TypeFilterPreferencePage.list.label=Filter list:
+TypeFilterPreferencePage.add.button=&New...
+TypeFilterPreferencePage.addpackage.button=Add &Packages...
+TypeFilterPreferencePage.edit.button=&Edit...
+TypeFilterPreferencePage.remove.button=&Remove
+TypeFilterPreferencePage.selectall.button=Ena&ble All
+TypeFilterPreferencePage.deselectall.button=Di&sable All
+
+TypeFilterPreferencePage.choosepackage.label=Package Selection
+TypeFilterPreferencePage.choosepackage.description=&Choose packages to filter:
+
+TypeFilterInputDialog.title=Type Filter
+TypeFilterInputDialog.message=&Type filter name ('*' and '?' are valid wildcards):
+TypeFilterInputDialog.browse.button=&Browse...
+TypeFilterInputDialog.error.enterName=Enter a qualified type name.
+TypeFilterInputDialog.error.invalidName=Invalid name: {0}.
+TypeFilterInputDialog.error.entryExists=Entry already exists.
+TypeFilterInputDialog.choosepackage.label=Package Selection
+TypeFilterInputDialog.choosepackage.description=&Choose packages to filter:
+
+WorkInProgress.quickdiff= Quick Diff
+WorkInProgress.quickdiff.changedLineColor= Changed lines background
+WorkInProgress.quickdiff.addedLineColor= Added lines background
+WorkInProgress.quickdiff.deletedLineColor= Deleted lines indicator
+WorkInProgress.quickdiff.appearanceOptions= Appearance color options:
+WorkInProgress.editor=Editor
+WorkInProgress.formatComments= Enable formatting of Javadoc, multi- and single line comments (reopen editor for activation)
+WorkInProgress.smartTyping.label= Enable the following functions in Smart Insert typing mode
+WorkInProgress.smartTyping.smartSemicolon= Smart &Semicolon
+WorkInProgress.smartTyping.smartOpeningBrace= Smart Opening &Brace
+WorkInProgress.smartTyping.smartTab= Smart &Tab
+WorkInProgress.formatter= Code Fomatter
+WorkInProgress.formatter.option= Enable new code fomatter (press 'Apply' before going to the formatter preference page)
+WorkInProgress.quickassist.group= Quick Assist
+WorkInProgress.quickassist.option= Enable light bulb for quick assists
+WorkInProgress.showQuickDiffPerDefault=Always show &Quick Diff coloring
+WorkInProgress.quickdiff.referenceprovidertitle=Quick Diff reference providers:
+WorkInProgress.quickdiff.setDefault=Make &Default
+WorkInProgress.quickdiff.defaultlabel= (default)
+WorkInProgress.quickdiff.characterMode= Show changes using &characters instead of colors (on line number bar only)
+WorkInProgress.search= Search
+WorkInProgress.search.small_menu=Use reduced search menu
+WorkInProgress.newsearch.option=Use new search view
+WorkInProgress.search.ignore_imports=Ignore references in imports statements
+WorkInProgress.rollover= Enable annotation &roll-over (does not affect already open editors)
+
+JavadocPreferencePage.title=Javadoc
+
+SpellingPreferencePage.description=Options for Spelling:
+SpellingPreferencePage.title=Spelling
+SpellingPreferencePage.empty_threshold=No number of correction proposals specified
+SpellingPreferencePage.invalid_threshold=''{0}'' is not a valid number for correction proposals
+SpellingPreferencePage.enable.label=Sp&ell-check comments
+SpellingPreferencePage.ignore.digits.label=Ignore words with &digits
+SpellingPreferencePage.ignore.mixed.label=Ignore &mixed case words
+SpellingPreferencePage.ignore.sentence.label=Ignore &sentence capitalization
+SpellingPreferencePage.ignore.upper.label=Ignore u&pper case words
+SpellingPreferencePage.ignore.url.label=Ignore &internet addresses
+SpellingPreferencePage.proposals.threshold=&Number of correction proposals:
+SpellingPreferencePage.dictionary.label=&Platform dictionary:
+SpellingPreferencePage.workspace.dictionary.label=&User defined dictionary:
+SpellingPreferencePage.browse.label=&Browse...
+SpellingPreferencePage.dictionary.error=The dictionary must be a readable and writable file
+SpellingPreferencePage.locale.error=There exists no dictionary for this language
+SpellingPreferencePage.filedialog.title=Select dictionary
+SpellingPreferencePage.filter.dictionary.extension=*.dictionary
+SpellingPreferencePage.filter.all.extension=*.*
+SpellingPreferencePage.filter.dictionary.label=Dictionary Files
+SpellingPreferencePage.filter.all.label=All Files
+SpellingPreferencePage.enable.contentassist.label=&Make dictionary available to content assist
+
+SpellingPreferencePage.preferences.user=&Comments
+SpellingPreferencePage.preferences.engine=&Language
+SpellingPreferencePage.preferences.advanced=&Advanced
+
+
+JavaEditorPreferencePage.AnnotationDecoration.NONE=None
+JavaEditorPreferencePage.AnnotationDecoration.SQUIGGLIES=Squiggles
+JavaEditorPreferencePage.AnnotationDecoration.UNDERLINE=Underline
+JavaEditorPreferencePage.AnnotationDecoration.BOX=Box
+JavaEditorPreferencePage.AnnotationDecoration.IBEAM=IBeam
--- /dev/null
+###############################################################################
+# Copyright (c) 2000, 2003 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Common Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/cpl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+
+BuildPathsPropertyPage.error.message=An error occurred while setting the build path
+BuildPathsPropertyPage.error.title=Error Setting Build Path
+BuildPathsPropertyPage.no_java_project.message=Not a Java project.
+BuildPathsPropertyPage.closed_project.message=Java information is not available for a closed project.
+
+ClasspathVariablesPreferencePage.title=Classpath Variables
+ClasspathVariablesPreferencePage.description=A classpath variable can be added to a project's class path. It can be used to define the location of a JAR file that isn't part of the workspace. The reserved class path variables JRE_LIB, JRE_SRC, JRE_SRCROOT are set internally depending on the JRE setting.
+
+ImportOrganizePreferencePage.description=Preferences used by the Organize Imports action:
+
+ImportOrganizePreferencePage.order.label=Define the &sorting order of import statements. A package name prefix (e.g. org.eclipse) is a valid entry.
+
+ImportOrganizePreferencePage.order.add.button=&New..
+ImportOrganizePreferencePage.order.edit.button=&Edit...
+ImportOrganizePreferencePage.order.up.button=&Up
+ImportOrganizePreferencePage.order.down.button=Do&wn
+ImportOrganizePreferencePage.order.remove.button=&Remove
+ImportOrganizePreferencePage.order.load.button=&Load...
+ImportOrganizePreferencePage.order.save.button=Sa&ve...
+ImportOrganizePreferencePage.ignoreLowerCase.label=Do not create imports for &types starting with a lowercase letter
+
+ImportOrganizePreferencePage.threshold.label=Number of &imports needed for .* (e.g. org.eclipse.*):
+ImportOrganizePreferencePage.error.invalidthreshold=Invalid import number.
+
+ImportOrganizePreferencePage.loadDialog.title=Load Import Order from File
+ImportOrganizePreferencePage.loadDialog.error.title=Load Import Order
+ImportOrganizePreferencePage.loadDialog.error.message=Loading failed. Not a valid import order file.
+
+ImportOrganizePreferencePage.saveDialog.title=Save Import Order to File
+ImportOrganizePreferencePage.saveDialog.error.title=Save Import Order
+ImportOrganizePreferencePage.saveDialog.error.message=Writing import order file failed.
+
+
+ImportOrganizeInputDialog.title=Import Order Entry
+ImportOrganizeInputDialog.message=&Package name or package name prefix:
+ImportOrganizeInputDialog.browse.button=&Browse...
+ImportOrganizeInputDialog.ChoosePackageDialog.title=Package Selection
+ImportOrganizeInputDialog.ChoosePackageDialog.description=Choose package name or package prefix:
+ImportOrganizeInputDialog.ChoosePackageDialog.empty=No packages available.
+ImportOrganizeInputDialog.error.enterName=Enter a package name.
+ImportOrganizeInputDialog.error.invalidName=Not a valid package name. {0}
+ImportOrganizeInputDialog.error.entryExists=Package name already exists in list.
+
+JavaBasePreferencePage.description=General settings for Java development:
+
+JavaBasePreferencePage.updateJavaViews=Update Java views
+JavaBasePreferencePage.onSave=On &save only
+JavaBasePreferencePage.whileEditing=While &editing
+JavaBasePreferencePage.notice.outliner=Note: This preference is not applied to already opened views (Outline view is always updated while editing)
+
+JavaBasePreferencePage.openTypeHierarchy=When opening a Type Hierarchy
+JavaBasePreferencePage.inPerspective=Open a new Type Hierarchy &Perspective
+JavaBasePreferencePage.inView=Show the &Type Hierarchy View in the current perspective
+JavaBasePreferencePage.doubleclick.action=Action on double click in the Package Explorer
+JavaBasePreferencePage.doubleclick.gointo=&Go into the selected element
+JavaBasePreferencePage.doubleclick.expand=E&xpand the selected element
+
+NewJavaProjectPreferencePage.description=Specify the classpath entries used as default by the New Java Project creation wizard:
+
+NewJavaProjectPreferencePage.sourcefolder.label=Source and output folder
+NewJavaProjectPreferencePage.sourcefolder.project=&Project
+NewJavaProjectPreferencePage.sourcefolder.folder=&Folders
+NewJavaProjectPreferencePage.folders.src=&Source folder name:
+NewJavaProjectPreferencePage.folders.bin=&Output folder name:
+
+NewJavaProjectPreferencePage.jrelibrary.label=As &JRE library use:
+NewJavaProjectPreferencePage.jre_variable.description=JRE_LIB variable
+NewJavaProjectPreferencePage.jre_container.description=JRE container
+
+NewJavaProjectPreferencePage.folders.error.namesempty=Enter folder names.
+NewJavaProjectPreferencePage.folders.error.invalidsrcname=Invalid source folder name: {0}
+NewJavaProjectPreferencePage.folders.error.invalidbinname=Invalid output folder name: {0}
+NewJavaProjectPreferencePage.folders.error.invalidcp=Settings will result in an invalid build path. Check for nested folders.
+
+NewJavaProjectPreferencePage.error.decode=Error while decoding JRE entry
+
+JavaEditorPreferencePage.annotationsTab.title= Annotation&s
+JavaEditorPreferencePage.showQuickFixables= Indicate annotations solvable with &Quick Fix in vertical ruler
+JavaEditorPreferencePage.analyseAnnotationsWhileTyping= Analyze annotations &while typing
+JavaEditorPreferencePage.annotationPresentationOptions= Annotation &presentation:
+JavaEditorPreferencePage.description=Java Editor settings:
+JavaEditorPreferencePage.annotations.bookmarks= Bookmarks
+JavaEditorPreferencePage.annotations.searchResults= Search Results
+JavaEditorPreferencePage.annotations.errors= Errors
+JavaEditorPreferencePage.annotations.warnings= Warnings
+JavaEditorPreferencePage.annotations.tasks= Tasks
+JavaEditorPreferencePage.annotations.others= Others
+JavaEditorPreferencePage.annotations.showInText= Show in &text
+TextEditorPreferencePage.annotations.highlightInText= &Highlight in text
+JavaEditorPreferencePage.annotations.showInOverviewRuler= Show in overview &ruler
+JavaEditorPreferencePage.annotations.showInVerticalRuler= Show in vertical r&uler
+JavaEditorPreferencePage.annotations.color= C&olor:
+JavaEditorPreferencePage.multiLineComment=Multi-line comment
+JavaEditorPreferencePage.singleLineComment=Single-line comment
+JavaEditorPreferencePage.keywords=Keywords
+JavaEditorPreferencePage.strings=Strings
+JavaEditorPreferencePage.others=Others
+JavaEditorPreferencePage.javaCommentTaskTags=Task Tags
+JavaEditorPreferencePage.javaDocKeywords=Javadoc keywords
+JavaEditorPreferencePage.javaDocHtmlTags=Javadoc HTML tags
+JavaEditorPreferencePage.javaDocLinks=Javadoc links
+JavaEditorPreferencePage.javaDocOthers=Javadoc others
+JavaEditorPreferencePage.backgroundColor=Background color
+JavaEditorPreferencePage.systemDefault=S&ystem Default
+JavaEditorPreferencePage.custom=C&ustom:
+JavaEditorPreferencePage.foreground=Fo®round:
+JavaEditorPreferencePage.color=C&olor:
+JavaEditorPreferencePage.bold=&Bold
+JavaEditorPreferencePage.preview=Preview:
+JavaEditorPreferencePage.displayedTabWidth=Displayed &tab width:
+JavaEditorPreferencePage.insertSpaceForTabs=Ins&ert space for tabs (see Code Formatter preference page)
+JavaEditorPreferencePage.showOverviewRuler=Show overview &ruler
+JavaEditorPreferencePage.highlightMatchingBrackets=Highlight &matching brackets
+JavaEditorPreferencePage.highlightCurrentLine=Hi&ghlight current line
+JavaEditorPreferencePage.showPrintMargin=Sho&w print margin
+JavaEditorPreferencePage.printMarginColumn=Print margin col&umn:
+JavaEditorPreferencePage.insertSingleProposalsAutomatically=Insert single &proposals automatically
+JavaEditorPreferencePage.showOnlyProposalsVisibleInTheInvocationContext=Show only proposals &visible in the invocation context
+JavaEditorPreferencePage.presentProposalsInAlphabeticalOrder=Present proposals in a&lphabetical order
+JavaEditorPreferencePage.enableAutoActivation=&Enable auto activation
+JavaEditorPreferencePage.automaticallyAddImportInsteadOfQualifiedName=Automatically add import instead of &qualified name
+JavaEditorPreferencePage.completionInserts=Completion inser&ts
+JavaEditorPreferencePage.completionOverwrites=Completion over&writes
+JavaEditorPreferencePage.fillArgumentNamesOnMethodCompletion=&Fill argument names on method completion
+JavaEditorPreferencePage.guessArgumentNamesOnMethodCompletion=&Guess filled argument names
+JavaEditorPreferencePage.autoActivationDelay=Auto activation dela&y:
+JavaEditorPreferencePage.autoActivationTriggersForJava=Auto activation &triggers for Java:
+JavaEditorPreferencePage.autoActivationTriggersForJavaDoc=Auto activation triggers for &Javadoc:
+
+JavaEditorPreferencePage.codeAssist.colorOptions= Code assist colo&r options:
+JavaEditorPreferencePage.codeAssist.color= C&olor:
+JavaEditorPreferencePage.backgroundForCompletionProposals= Completion proposal background
+JavaEditorPreferencePage.foregroundForCompletionProposals= Completion proposal foreground
+JavaEditorPreferencePage.backgroundForMethodParameters= Method parameter background
+JavaEditorPreferencePage.foregroundForMethodParameters= Method parameter foreground
+JavaEditorPreferencePage.backgroundForCompletionReplacement= Completion overwrite background
+JavaEditorPreferencePage.foregroundForCompletionReplacement= Completion overwrite foreground
+
+JavaEditorPreferencePage.general=Appeara&nce
+JavaEditorPreferencePage.colors=Synta&x
+JavaEditorPreferencePage.codeAssist= &Code Assist
+JavaEditorPreferencePage.empty_input=Empty input
+JavaEditorPreferencePage.invalid_input=''{0}'' is not a valid input.
+JavaEditorPreferencePage.showLineNumbers=Show lin&e numbers
+JavaEditorPreferencePage.lineNumberForegroundColor=Line number foreground
+JavaEditorPreferencePage.matchingBracketsHighlightColor2=Matching brackets highlight
+JavaEditorPreferencePage.currentLineHighlighColor=Current line highlight
+JavaEditorPreferencePage.printMarginColor2=Print margin
+JavaEditorPreferencePage.findScopeColor2=Find scope
+JavaEditorPreferencePage.linkedPositionColor2=Linked position
+JavaEditorPreferencePage.linkColor2=Link
+JavaEditorPreferencePage.synchronizeOnCursor=Synchroni&ze outline selection on cursor move (editor must be reopened)
+JavaEditorPreferencePage.appearanceOptions=Appearance co&lor options:
+
+JavaEditorPreferencePage.typing.tabTitle= T&yping
+JavaEditorPreferencePage.typing.description= Select options for automatic text modifications
+JavaEditorPreferencePage.closeStrings= Close strin&gs
+JavaEditorPreferencePage.closeBrackets= Close &brackets and parenthesis
+JavaEditorPreferencePage.closeBraces= Cl&ose braces
+JavaEditorPreferencePage.closeJavaDocs= Close Java&docs and comments
+JavaEditorPreferencePage.wrapStrings= &Wrap Java strings
+JavaEditorPreferencePage.addJavaDocTags= Add Javadoc &tags
+JavaEditorPreferencePage.smartPaste= Pasting fo&r correct indentation
+
+JavaEditorPreferencePage.smartHomeEnd= S&mart cursor positioning at line start and end
+
+JavaEditorPreferencePage.hoverTab.title= Ho&vers
+
+JavaEditorPreferencePage.navigationTab.title= Nav&igation
+JavaEditorPreferencePage.navigation.browserLikeLinks= S&upport hyperlink style navigation for "Open Declaration"
+JavaEditorPreferencePage.navigation.browserLikeLinksKeyModifier= Hyperlink style navigation key &modifier:
+JavaEditorPreferencePage.navigation.modifierIsNotValid= Modifier ''{0}'' is not valid.
+JavaEditorPreferencePage.navigation.shiftIsDisabled= The modifier 'Shift' is not allowed because 'Shift' + click sets a new selection.
+
+JavaEditorPreferencePage.navigation.delimiter= +
+JavaEditorPreferencePage.navigation.insertDelimiterAndModifierAndDelimiter= \ + {0} +
+JavaEditorPreferencePage.navigation.insertModifierAndDelimiter= \ {0} +
+JavaEditorPreferencePage.navigation.insertDelimiterAndModifier= \ + {0}
+
+JavaEditorHoverConfigurationBlock.hoverPreferences= &Hover key modifier preferences:
+JavaEditorHoverConfigurationBlock.enabled= &Enabled
+JavaEditorHoverConfigurationBlock.keyModifier= Key &Modifier:
+JavaEditorHoverConfigurationBlock.description= Description:
+JavaEditorHoverConfigurationBlock.modifierIsNotValid= Modifier ''{0}'' is not valid.
+JavaEditorHoverConfigurationBlock.modifierIsNotValidForHover= Modifier ''{0}'' for ''{1}'' hover is not valid.
+JavaEditorHoverConfigurationBlock.duplicateModifier= ''{0}'' hover uses the same modifier as ''{1}'' hover.
+
+JavaEditorHoverConfigurationBlock.delimiter= +
+JavaEditorHoverConfigurationBlock.insertDelimiterAndModifierAndDelimiter= \ + {0} +
+JavaEditorHoverConfigurationBlock.insertModifierAndDelimiter= \ {0} +
+JavaEditorHoverConfigurationBlock.insertDelimiterAndModifier= \ + {0}
+
+JavaElementInfoPage.binary=binary
+JavaElementInfoPage.classpath_entry_kind=Classpath entry kind:
+JavaElementInfoPage.library=library
+JavaElementInfoPage.nameLabel=Name:
+JavaElementInfoPage.not_present=not present
+JavaElementInfoPage.package=Package:
+JavaElementInfoPage.package_contents=Package contents:
+JavaElementInfoPage.project=project
+JavaElementInfoPage.resource_path=Resource path:
+JavaElementInfoPage.source=source
+JavaElementInfoPage.variable=variable
+JavaElementInfoPage.variable_path=Variable path:
+JavaElementInfoPage.location=Location:
+
+JavadocConfigurationPropertyPage.IsPackageFragmentRoot.description=Specify the location (URL) of the documentation generated by Javadoc. The Javadoc location will contain a file called 'package-list'. For example: \'http://www.sample-url.org/doc/\'
+JavadocConfigurationPropertyPage.IsIncorrectElement.description=Javadoc location can only be attached to Java projects or JAR files in Java projects
+JavadocConfigurationPropertyPage.IsJavaProject.description=Specify the location (URL) of the project\'s Javadoc documentation. This location is used by the Javadoc export wizard as default value and by the \'Open External Javadoc\' action. For example: \'file://c:/myworkspace/myproject/doc/\'.
+
+JavadocConfigurationBlock.location.label=Javadoc &location:
+JavadocConfigurationBlock.location.button=Bro&wse...
+
+JavadocConfigurationBlock.error.notafolder=Location does not exist.
+JavadocConfigurationBlock.warning.packagelistnotfound=Location does not contain file 'package-list'.
+
+JavadocConfigurationBlock.javadocLocationDialog.label=Javadoc Location Selection
+JavadocConfigurationBlock.javadocLocationDialog.message=&Select Javadoc location:
+
+JavadocConfigurationBlock.MalformedURL.error=Invalid URL
+
+JavadocConfigurationBlock.ValidateButton.label=&Validate...
+JavadocConfigurationBlock.InvalidLocation.message= Location is invalid. Location contains neither the file \'package-list\' nor \'index.html'.
+JavadocConfigurationBlock.ValidLocation.message= Location is valid. Files \'package-list\' and \'index.html\' found. Click OK to open in browser.
+JavadocConfigurationBlock.UnableToValidateLocation.message=Unable to validate location
+JavadocConfigurationBlock.MessageDialog.title=Validating Javadoc Location
+
+JavadocPreferencePage.description=Specify the location of the Javadoc command to be used by the Javadoc export wizard. Location must be an absolute path.
+JavadocPreferencePage.command.label=&Javadoc command:
+JavadocPreferencePage.command.button=Bro&wse...
+
+JavadocPreferencePage.error.notexists=Javadoc command does not exist
+
+JavadocPreferencePage.browsedialog.title=Javadoc Command Selection
+
+MembersOrderPreferencePage.button.up=U&p
+MembersOrderPreferencePage.button.down=Do&wn
+MembersOrderPreferencePage.label.description=&Choose the order in which members will be displayed. The order is also used by the 'Sort Members' action.
+
+SourceAttachmentPropertyPage.error.title=Error Attaching Source
+SourceAttachmentPropertyPage.error.message=An error occurred while associating the source
+
+SourceAttachmentPropertyPage.noarchive.message=Source can only be attached to JAR files in Java projects.
+SourceAttachmentPropertyPage.containerentry.message=JAR belongs to the container ''{0}''.\nTo configure the source attachment, go directly to the corresponding configuration page (For example for JREs go to ''Installed JREs'' page in the preferences).
+
+AppearancePreferencePage.description= Appearance of Java elements in viewers:
+AppearancePreferencePage.methodreturntype.label= Show &method return types
+AppearancePreferencePage.overrideindicator.label= Show &override indicators in outline and hierarchy
+AppearancePreferencePage.pkgNamePatternEnable.label= &Compress all package name segments, except the final segment
+AppearancePreferencePage.pkgNamePattern.label= Com&pression pattern (e.g. given package name 'org.eclipse.jdt' pattern '.' will compress it to '..jdt', '0' to 'jdt', '1~.' to 'o~.e~.jdt'):
+AppearancePreferencePage.showMembersInPackagesView=S&how members in Package Explorer
+AppearancePreferencePage.stackViewsVerticallyInTheJavaBrowsingPerspective=&Stack views vertically in the Java Browsing perspective
+AppearancePreferencePage.preferenceOnlyEffectiveForNewPerspectives=Note: This preference will only take effect on new perspectives
+AppearancePreferencePage.packageNameCompressionPattern.error.isEmpty=Enter a package name compression pattern
+AppearancePreferencePage.foldEmptyPackages= &Fold empty packages in hierarchical Package Explorer layout
+
+CodeFormatterPreferencePage.title=Code Formatter
+CodeFormatterPreferencePage.description=Options for the Java Code Formatter:
+
+CodeFormatterPreferencePage.empty_input=Empty input
+CodeFormatterPreferencePage.invalid_input=''{0}'' is not a valid input.
+
+CodeFormatterPreferencePage.newline_opening_braces.label=I&nsert a new line before an opening brace
+CodeFormatterPreferencePage.newline_control_statement.label=Insert new &lines in control statements
+CodeFormatterPreferencePage.newline_clear_lines=Clear all &blank lines
+CodeFormatterPreferencePage.newline_else_if.label=&Insert new line between 'else if'
+CodeFormatterPreferencePage.newline_empty_block.label=In&sert a new line inside an empty block
+CodeFormatterPreferencePage.split_line.label=Ma&ximum line length:
+CodeFormatterPreferencePage.style_compact_assignement.label=&Compact assignment
+CodeFormatterPreferencePage.style_space_castexpression.label=Insert sp&ace after a cast
+CodeFormatterPreferencePage.tab_char.label=Insert &tabs for indentation, not spaces
+CodeFormatterPreferencePage.tab_size.label=&Number of spaces representing an indentation level:
+
+CodeFormatterPreferencePage.tab.newline.tabtitle=Ne&w Lines
+CodeFormatterPreferencePage.tab.linesplit.tabtitle=Line S&plitting
+CodeFormatterPreferencePage.tab.style.tabtitle=St&yle
+
+TodoTaskPreferencePage.title=Task Tags
+
+TodoTaskPropertyPage.useworkspacesettings.label=Use &workspace settings
+TodoTaskPropertyPage.useworkspacesettings.change=&Configure Workspace Settings...
+TodoTaskPropertyPage.useprojectsettings.label=Use pr&oject settings
+
+TodoTaskConfigurationBlock.markers.tasks.high.priority=High
+TodoTaskConfigurationBlock.markers.tasks.normal.priority=Normal
+TodoTaskConfigurationBlock.markers.tasks.low.priority=Low
+TodoTaskConfigurationBlock.markers.tasks.label=&Strings indicating tasks in Java comments:
+TodoTaskConfigurationBlock.markers.tasks.add.button=Ne&w...
+TodoTaskConfigurationBlock.markers.tasks.remove.button=Remo&ve
+TodoTaskConfigurationBlock.markers.tasks.edit.button=Edi&t...
+TodoTaskConfigurationBlock.markers.tasks.name.column=Tag
+TodoTaskConfigurationBlock.markers.tasks.priority.column=Priority
+
+TodoTaskConfigurationBlock.needsbuild.title=Task Tags Settings Changed
+TodoTaskConfigurationBlock.needsfullbuild.message=The task tags settings have changed. A full rebuild is required to make changes effective. Do the full build now?
+TodoTaskConfigurationBlock.needsprojectbuild.message=The task tags settings have changed. A rebuild of the project is required to make changes effective. Do the project build now?
+
+TodoTaskInputDialog.new.title=New Task Tag
+TodoTaskInputDialog.edit.title=Edit Task Tag
+TodoTaskInputDialog.name.label=T&ag:
+TodoTaskInputDialog.priority.label=&Priority:
+TodoTaskInputDialog.priority.high=High
+TodoTaskInputDialog.priority.normal=Normal
+TodoTaskInputDialog.priority.low=Low
+TodoTaskInputDialog.error.enterName=Enter task tag name.
+TodoTaskInputDialog.error.comma=Name cannot contain a comma.
+TodoTaskInputDialog.error.entryExists=Entry with the same name already exists.
+TodoTaskInputDialog.error.noSpace=Name can not start or end with a whitespace.
+
+CompilerPreferencePage.title=Compiler
+CompilerPreferencePage.description=Options for the Java compiler:\nNote that a full rebuild is required to make changes effective.
+
+CompilerPropertyPage.useworkspacesettings.label=Use &workspace settings
+CompilerPropertyPage.useworkspacesettings.change=&Configure Workspace Settings...
+CompilerPropertyPage.useprojectsettings.label=Use pr&oject settings
+
+CompilerConfigurationBlock.style.tabtitle=&Style
+CompilerConfigurationBlock.problems.tabtitle=&Problems
+CompilerConfigurationBlock.compliance.tabtitle=&Compliance and Classfiles
+CompilerConfigurationBlock.others.tabtitle=&Build Path
+
+CompilerConfigurationBlock.style.description=Select the severity level for the following problems:
+CompilerConfigurationBlock.problems.description=Select the severity level for the following problems:
+CompilerConfigurationBlock.build_warnings.description=Select the severity level for the following build path problems:
+
+CompilerConfigurationBlock.variable_attr.label=Add &variable attributes to generated class files (used by the debugger)
+CompilerConfigurationBlock.line_number_attr.label=Add &line number attributes to generated class files (used by the debugger)
+CompilerConfigurationBlock.source_file_attr.label=Add source &file name to generated class file (used by the debugger)
+CompilerConfigurationBlock.codegen_unused_local.label=Pr&eserve unused local variables (i.e. never read)
+
+CompilerConfigurationBlock.compiler_compliance.label=C&ompiler compliance level:
+CompilerConfigurationBlock.default_settings.label=&Use default compliance settings
+CompilerConfigurationBlock.source_compatibility.label=Source co&mpatibility:
+CompilerConfigurationBlock.codegen_targetplatform.label=Ge&nerated .class files compatibility:
+CompilerConfigurationBlock.pb_assert_as_identifier.label=&Report 'assert' as identifier:
+
+CompilerConfigurationBlock.compliance.group.label=JDK Compliance
+CompilerConfigurationBlock.classfiles.group.label=Classfile Generation
+
+CompilerConfigurationBlock.pb_unreachable_code.label=&Unreachable code:
+CompilerConfigurationBlock.pb_invalid_import.label=Unresol&vable import statements:
+CompilerConfigurationBlock.pb_overriding_pkg_dflt.label=&Methods overridden but not package visible:
+CompilerConfigurationBlock.pb_method_naming.label=Me&thods with a constructor name:
+CompilerConfigurationBlock.pb_no_effect_assignment.label=Assignment has no &effect (e.g. 'x = x'):
+CompilerConfigurationBlock.pb_incompatible_interface_method.label=Conflict of interface method &with protected 'Object' method:
+
+
+CompilerConfigurationBlock.pb_hidden_catchblock.label=&Hidden catch blocks:
+CompilerConfigurationBlock.pb_static_access_receiver.label=Non-stat&ic access to static member
+CompilerConfigurationBlock.pb_unused_imports.label=Unus&ed imports:
+CompilerConfigurationBlock.pb_unused_local.label=Unused &local variables (i.e. never read):
+CompilerConfigurationBlock.pb_unused_parameter.label=U&nused parameters (i.e. never read):
+CompilerConfigurationBlock.pb_unused_private.label=Unused private &types, methods or fields:
+CompilerConfigurationBlock.pb_non_externalized_strings.label=Usage of non-e&xternalized strings:
+CompilerConfigurationBlock.pb_deprecation.label=Usa&ge of deprecated API:
+CompilerConfigurationBlock.pb_deprecation_in_deprecation.label=Signal use &of deprecated API inside deprecated code.
+
+CompilerConfigurationBlock.pb_synth_access_emul.label=Access to a &non-accessible member of an enclosing type:
+CompilerConfigurationBlock.pb_char_array_in_concat.label=&Using a char array in string concatenation:
+CompilerConfigurationBlock.pb_incomplete_build_path.label=&Incomplete build path:
+CompilerConfigurationBlock.pb_build_path_cycles.label=Circular d&ependencies:
+CompilerConfigurationBlock.pb_duplicate_resources.label=D&uplicated resources:
+CompilerConfigurationBlock.pb_max_per_unit.label=Ma&ximum number of problems reported per compilation unit:
+
+
+CompilerConfigurationBlock.resource_filter.description=Enter resources and resource types that should not be copied to the output folder during a build. List is comma separated (e.g. '*.doc, plugin.xml, scripts/')
+CompilerConfigurationBlock.resource_filter.label=Filtered &Resources:
+CompilerConfigurationBlock.build_invalid_classpath.label=Ab&ort building on build path errors
+CompilerConfigurationBlock.build_clean_outputfolder.label=Scrub output folders o&n full build
+CompilerConfigurationBlock.enable_exclusion_patterns.label=Enable using e&xclusion patterns in source folders
+CompilerConfigurationBlock.enable_multiple_outputlocations.label=Enable using &multiple output locations for source folders
+
+CompilerConfigurationBlock.error=Error
+CompilerConfigurationBlock.warning=Warning
+CompilerConfigurationBlock.ignore=Ignore
+
+CompilerConfigurationBlock.version11=1.1
+CompilerConfigurationBlock.version12=1.2
+CompilerConfigurationBlock.version13=1.3
+CompilerConfigurationBlock.version14=1.4
+
+CompilerConfigurationBlock.needsbuild.title=Compiler Settings Changed
+CompilerConfigurationBlock.needsfullbuild.message=The compiler settings have changed. A full rebuild is required to make changes effective. Do the full build now?
+CompilerConfigurationBlock.needsprojectbuild.message=The compiler settings have changed. A rebuild of the project is required to make changes effective. Do the project build now?
+
+CompilerConfigurationBlock.cpl13src14.error=In 1.3 compliance level, source compatibility can not be 1.4
+CompilerConfigurationBlock.cpl13trg14.error=In 1.3 compliance level, the classfile compatibility can not be 1.4
+CompilerConfigurationBlock.src14asrterr.error=When source compatibility is 1.4, 'assert' cannot be an identifier.
+CompilerConfigurationBlock.src14tgt14.error=When source compatibility is 1.4, the classfile compatibility has to be 1.4.
+
+CompilerConfigurationBlock.empty_input=Number of problems can not be empty.
+CompilerConfigurationBlock.invalid_input={0} is not a valid number of problems.
+
+CompilerConfigurationBlock.filter.invalidsegment.error=Filter is invalid: {0}
+
+OptionsConfigurationBlock.builderror.title=Preference Changes
+OptionsConfigurationBlock.builderror.message=Problem while building. Check log for details.
+
+OptionsConfigurationBlock.buildall.taskname=Build all...
+OptionsConfigurationBlock.buildproject.taskname=Build project ''{0}''...
+
+CodeGenerationPreferencePage.title=&Code Generation
+CodeGenerationPreferencePage.description=Options for Code Generation:
+
+CodeGenerationPreferencePage.tab.names.tabtitle=&Names
+CodeGenerationPreferencePage.tab.templates.tabtitle=&Code and Comments
+
+NameConventionConfigurationBlock.field.label=Fields
+NameConventionConfigurationBlock.static.label=Static Fields
+NameConventionConfigurationBlock.arg.label=Parameters
+NameConventionConfigurationBlock.local.label=Local Variables
+
+NameConventionConfigurationBlock.dialog.prefix=P&refix list:
+NameConventionConfigurationBlock.dialog.suffix=S&uffix list:
+
+NameConventionConfigurationBlock.error.emptyprefix=Prefix strings can not contain an empty entry.
+NameConventionConfigurationBlock.error.emptysuffix=Suffix strings can not contain an empty entry.
+NameConventionConfigurationBlock.error.invalidprefix={0} is not a valid prefix.
+NameConventionConfigurationBlock.error.invalidsuffix={0} is not a valid suffix.
+
+NameConventionConfigurationBlock.list.label=C&onventions for variable names:
+NameConventionConfigurationBlock.list.edit.button=&Edit...
+NameConventionConfigurationBlock.list.name.column=Variable type
+NameConventionConfigurationBlock.list.prefix.column=Prefix list
+NameConventionConfigurationBlock.list.suffix.column=Suffix list
+
+NameConventionConfigurationBlock.field.dialog.title=Field Name Conventions
+NameConventionConfigurationBlock.field.dialog.message=Specify prefix and suffix to be used for fields (comma separated):
+
+NameConventionConfigurationBlock.static.dialog.title=Static Field Name Conventions
+NameConventionConfigurationBlock.static.dialog.message=Specify prefix and suffix to be used for static fields (comma separated):
+
+NameConventionConfigurationBlock.arg.dialog.title=Parameter Name Conventions
+NameConventionConfigurationBlock.arg.dialog.message=Specify prefix and suffix to be used for parameters (comma separated):
+
+NameConventionConfigurationBlock.local.dialog.title=Local Variable Name Conventions
+NameConventionConfigurationBlock.local.dialog.message=Specify prefix and suffix to be used for local variables (comma separated):
+
+MembersOrderPreferencePage.fields.label=Fields
+MembersOrderPreferencePage.constructors.label=Constructors
+MembersOrderPreferencePage.methods.label=Methods
+MembersOrderPreferencePage.staticfields.label=Static Fields
+MembersOrderPreferencePage.staticmethods.label=Static Methods
+MembersOrderPreferencePage.initialisers.label=Initializers
+MembersOrderPreferencePage.staticinitialisers.label=Static Initializers
+MembersOrderPreferencePage.types.label=Types
+
+CodeTemplateBlock.templates.comment.node=Comments
+CodeTemplateBlock.templates.code.node=Code
+
+CodeTemplateBlock.catchblock.label=Catch block body
+CodeTemplateBlock.methodstub.label=Method body
+CodeTemplateBlock.constructorstub.label=Constructor body
+CodeTemplateBlock.newtype.label=New Java files
+CodeTemplateBlock.typecomment.label=Types
+CodeTemplateBlock.methodcomment.label=Methods
+CodeTemplateBlock.overridecomment.label=Overriding methods
+CodeTemplateBlock.constructorcomment.label=Constructors
+
+CodeTemplateBlock.templates.edit.button=&Edit...
+CodeTemplateBlock.templates.import.button=&Import...
+CodeTemplateBlock.templates.export.button=E&xport...
+CodeTemplateBlock.templates.exportall.button=Ex&port All...
+
+CodeTemplateBlock.createcomment.label=A&utomatically add comments for new methods and types
+CodeTemplateBlock.createcomment.description=(does not apply to comments contained in the code patterns)
+CodeTemplateBlock.templates.label=C&onfigure generated code and comments:
+CodeTemplateBlock.preview=Pa&ttern:
+
+CodeTemplateBlock.import.title=Importing Templates
+CodeTemplateBlock.import.extension=*.xml
+
+CodeTemplateBlock.export.title=Exporting {0} Code Template(s)
+CodeTemplateBlock.export.filename=codetemplates.xml
+CodeTemplateBlock.export.extension=*.xml
+
+CodeTemplateBlock.export.exists.title=Exporting Code Templates
+CodeTemplateBlock.export.exists.message={0} already exists.\nDo you want to replace it?
+
+CodeTemplateBlock.error.read.title= Code Templates
+CodeTemplateBlock.error.read.message= Failed to read templates.
+
+CodeTemplateBlock.error.parse.message= Failed to parse templates:\n{0}
+
+CodeTemplateBlock.error.write.title=Code Templates
+CodeTemplateBlock.error.write.message=Failed to write templates.
+
+CodeTemplateBlock.export.error.title= Exporting Templates
+CodeTemplateBlock.export.error.hidden= Export failed.\n{0} is a hidden file.
+CodeTemplateBlock.export.error.canNotWrite= Export failed.\n{0} can not be modified.
+CodeTemplateBlock.export.error.fileNotFound= Export failed:\n{0}
+
+JavaEditorPreferencePage.AnnotationDecoration.NONE=None
+JavaEditorPreferencePage.AnnotationDecoration.SQUIGGLIES=Squiggles
+JavaEditorPreferencePage.AnnotationDecoration.UNDERLINE=Underline
+JavaEditorPreferencePage.AnnotationDecoration.BOX=Box
+JavaEditorPreferencePage.AnnotationDecoration.IBEAM=IBeam
package net.sourceforge.phpdt.internal.ui.util;
-import net.sourceforge.phpdt.internal.ui.dialog.ElementListSelectionDialog;
+import net.sourceforge.phpdt.internal.ui.dialogs.ElementListSelectionDialog;
import net.sourceforge.phpeclipse.PHPeclipsePlugin;
import org.eclipse.core.resources.IFile;
package net.sourceforge.phpdt.internal.ui.util;
import net.sourceforge.phpdt.core.JavaCore;
-import net.sourceforge.phpdt.internal.ui.dialog.ElementListSelectionDialog;
+import net.sourceforge.phpdt.internal.ui.dialogs.ElementListSelectionDialog;
import net.sourceforge.phpeclipse.PHPeclipsePlugin;
import org.eclipse.core.resources.IProject;
* Value is of type <code>Boolean</code>.
* </p>
*/
- public final static String EDITOR_PROBLEM_INDICATION = "problemIndication"; //$NON-NLS-1$
+// public final static String EDITOR_PROBLEM_INDICATION = "problemIndication"; //$NON-NLS-1$
/**
* A named preference that holds the color used to render problem indicators.
* @see org.eclipse.jface.resource.StringConverter
* @see org.eclipse.jface.preference.PreferenceConverter
*/
- public final static String EDITOR_PROBLEM_INDICATION_COLOR = "problemIndicationColor"; //$NON-NLS-1$
+// public final static String EDITOR_PROBLEM_INDICATION_COLOR = "problemIndicationColor"; //$NON-NLS-1$
/**PreferenceConstants.EDITOR_PROBLEM_INDICATION_COLOR;
* A named preference that controls whether the editor shows warning indicators in text (squiggly lines).
* Value is of type <code>Boolean</code>.
* </p>
*/
- public final static String EDITOR_WARNING_INDICATION = "warningIndication"; //$NON-NLS-1$
+// public final static String EDITOR_WARNING_INDICATION = "warningIndication"; //$NON-NLS-1$
/**
* A named preference that holds the color used to render warning indicators.
* @see org.eclipse.jface.resource.StringConverter
* @see org.eclipse.jface.preference.PreferenceConverter
*/
- public final static String EDITOR_WARNING_INDICATION_COLOR = "warningIndicationColor"; //$NON-NLS-1$
+// public final static String EDITOR_WARNING_INDICATION_COLOR = "warningIndicationColor"; //$NON-NLS-1$
/**
* A named preference that controls whether the editor shows task indicators in text (squiggly lines).
public final static String EDITOR_JAVA_DEFAULT_BOLD = IPreferenceConstants.PHP_DEFAULT + EDITOR_BOLD_SUFFIX;
/**
+ * A named preference that holds the color used to render task tags.
+ * <p>
+ * Value is of type <code>String</code>. A RGB color value encoded as a string
+ * using class <code>PreferenceConverter</code>
+ * </p>
+ *
+ * @see org.eclipse.jface.resource.StringConverter
+ * @see org.eclipse.jface.preference.PreferenceConverter
+ * @since 2.1
+ */
+ public final static String EDITOR_TASK_TAG_COLOR= IPreferenceConstants.TASK_TAG;
+
+ /**
+ * A named preference that controls whether task tags are rendered in bold.
+ * <p>
+ * Value is of type <code>Boolean</code>.
+ * </p>
+ * @since 2.1
+ */
+ public final static String EDITOR_TASK_TAG_BOLD= IPreferenceConstants.TASK_TAG + EDITOR_BOLD_SUFFIX;
+
+ /**
* A named preference that holds the color used to render phpdoc keywords.
* <p>
* Value is of type <code>String</code>. A RGB color value encoded as a string
PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_FIND_SCOPE_COLOR, new RGB(185, 176, 180));
- store.setDefault(PreferenceConstants.EDITOR_PROBLEM_INDICATION, true);
- PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_PROBLEM_INDICATION_COLOR, new RGB(255, 0, 128));
- store.setDefault(PreferenceConstants.EDITOR_ERROR_INDICATION_IN_OVERVIEW_RULER, true);
-
- store.setDefault(PreferenceConstants.EDITOR_WARNING_INDICATION, true);
- PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_WARNING_INDICATION_COLOR, new RGB(244, 200, 45));
- store.setDefault(PreferenceConstants.EDITOR_WARNING_INDICATION_IN_OVERVIEW_RULER, true);
-
- store.setDefault(PreferenceConstants.EDITOR_TASK_INDICATION, false);
- PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_TASK_INDICATION_COLOR, new RGB(0, 128, 255));
- store.setDefault(PreferenceConstants.EDITOR_TASK_INDICATION_IN_OVERVIEW_RULER, false);
-
- store.setDefault(PreferenceConstants.EDITOR_BOOKMARK_INDICATION, false);
- PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_BOOKMARK_INDICATION_COLOR, new RGB(34, 164, 99));
- store.setDefault(PreferenceConstants.EDITOR_BOOKMARK_INDICATION_IN_OVERVIEW_RULER, false);
-
- store.setDefault(PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION, false);
- PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION_COLOR, new RGB(192, 192, 192));
- store.setDefault(PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION_IN_OVERVIEW_RULER, false);
-
- store.setDefault(PreferenceConstants.EDITOR_UNKNOWN_INDICATION, false);
- PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_UNKNOWN_INDICATION_COLOR, new RGB(0, 0, 0));
- store.setDefault(PreferenceConstants.EDITOR_UNKNOWN_INDICATION_IN_OVERVIEW_RULER, false);
+// store.setDefault(PreferenceConstants.EDITOR_PROBLEM_INDICATION, true);
+// PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_PROBLEM_INDICATION_COLOR, new RGB(255, 0, 128));
+// store.setDefault(PreferenceConstants.EDITOR_ERROR_INDICATION_IN_OVERVIEW_RULER, true);
+//
+// store.setDefault(PreferenceConstants.EDITOR_WARNING_INDICATION, true);
+// PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_WARNING_INDICATION_COLOR, new RGB(244, 200, 45));
+// store.setDefault(PreferenceConstants.EDITOR_WARNING_INDICATION_IN_OVERVIEW_RULER, true);
+//
+// store.setDefault(PreferenceConstants.EDITOR_TASK_INDICATION, false);
+// PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_TASK_INDICATION_COLOR, new RGB(0, 128, 255));
+// store.setDefault(PreferenceConstants.EDITOR_TASK_INDICATION_IN_OVERVIEW_RULER, false);
+//
+// store.setDefault(PreferenceConstants.EDITOR_BOOKMARK_INDICATION, false);
+// PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_BOOKMARK_INDICATION_COLOR, new RGB(34, 164, 99));
+// store.setDefault(PreferenceConstants.EDITOR_BOOKMARK_INDICATION_IN_OVERVIEW_RULER, false);
+//
+// store.setDefault(PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION, false);
+// PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION_COLOR, new RGB(192, 192, 192));
+// store.setDefault(PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION_IN_OVERVIEW_RULER, false);
+//
+// store.setDefault(PreferenceConstants.EDITOR_UNKNOWN_INDICATION, false);
+// PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_UNKNOWN_INDICATION_COLOR, new RGB(0, 0, 0));
+// store.setDefault(PreferenceConstants.EDITOR_UNKNOWN_INDICATION_IN_OVERVIEW_RULER, false);
store.setDefault(PreferenceConstants.EDITOR_CORRECTION_INDICATION, true);
store.setDefault(PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE, false);
import org.eclipse.core.runtime.Preferences;
import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IDocumentExtension3;
import org.eclipse.jface.text.IDocumentPartitioner;
import org.eclipse.jface.text.rules.DefaultPartitioner;
import org.eclipse.jface.text.rules.IPartitionTokenScanner;
return partitioner;
}
+ /**
+ * Sets up the Java document partitioner for the given document for the given partitioning.
+ *
+ * @param document the document to be set up
+ * @param partitioning the document partitioning
+ * @since 3.0
+ */
+ public void setupJavaDocumentPartitioner(IDocument document, String partitioning) {
+ IDocumentPartitioner partitioner= createDocumentPartitioner();
+ if (document instanceof IDocumentExtension3) {
+ IDocumentExtension3 extension3= (IDocumentExtension3) document;
+ extension3.setDocumentPartitioner(partitioning, partitioner);
+ } else {
+ document.setDocumentPartitioner(partitioner);
+ }
+ partitioner.connect(document);
+ }
+
/**
* Returns the names of the document position categories used by the document
* partitioners created by this object to manage their partition information.
package net.sourceforge.phpdt.ui.wizards;
import net.sourceforge.phpdt.externaltools.internal.ui.StatusInfo;
-import net.sourceforge.phpdt.internal.ui.dialog.StatusUtil;
+import net.sourceforge.phpdt.internal.ui.dialogs.StatusUtil;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.wizard.WizardPage;
public static final String LOCALHOST_PREF = "_localhost";
public static final String DOCUMENTROOT_PREF = "_documentroot";
public static final String USE_EXTERNAL_BROWSER_PREF = "_use_external_browser";
- public static final String SHOW_EXTERNAL_PREVIEW_PREF = "_show_external_preview";
+// public static final String SHOW_EXTERNAL_PREVIEW_PREF = "_show_external_preview";
public static final String EXTERNAL_BROWSER_PREF = "_external_browser";
public static final String MYSQL_RUN_PREF = "_mysql_run_pref";
public static final String MYSQL_START_BACKGROUND = "_mysql_start_background";
public static final String PHP_DEFAULT_BOLD = "_php_default_bold";
public static final String PHP_DEFAULT_ITALIC = "_php_default_italic";
public static final String PHP_DEFAULT_UNDERLINE = "_php_default_underline";
-
+ public static final String TASK_TAG= "_php_comment_task_tag"; //$NON-NLS-1$
+ public static final String TASK_TAG_BOLD = "_php_comment_task_tag_bold"; //$NON-NLS-1$
+
/** The color key for PHPDoc keywords (<code>@foo</code>) in PHPDoc comments. */
public static final String PHPDOC_KEYWORD = "_php_doc_keyword"; //$NON-NLS-1$
public static final String PHPDOC_KEYWORD_BOLD = "_php_doc_keyword_bold";
public static final String PHP_OUTLINE_FUNC = "_php_outline_func"; //$NON-NLS-1$
public static final String PHP_OUTLINE_VAR = "_php_outline_var"; //$NON-NLS-1$
+ public static final String PHP_OBFUSCATOR_DEFAULT = "_php_obfuscator_default";
+ public static final String PHP_BOOKMARK_DEFAULT = "_php_bookmark_default";
+
+ public static final String PHP_AUTO_PREVIEW_DEFAULT = "_auto_preview";
+ public static final String PHP_BRING_TO_TOP_PREVIEW_DEFAULT = "_bring_to_top_preview";
}
\ No newline at end of file
StringFieldEditor localHostSFE;
DirectoryFieldEditor documentRootDFE;
- BooleanFieldEditor showExternalPreviewBFE;
+// BooleanFieldEditor showExternalPreviewBFE;
BooleanFieldEditor externalBrowserBFE;
StringFieldEditor externalBrowserSFE;
StringFieldEditor apacheStartSFE;
protected void performDefaults() {
localHostSFE.loadDefault();
documentRootDFE.loadDefault();
- showExternalPreviewBFE.loadDefault();
+// showExternalPreviewBFE.loadDefault();
externalBrowserBFE.loadDefault();
externalBrowserSFE.loadDefault();
apacheStartSFE.loadDefault();
public boolean performOk() {
localHostSFE.store();
documentRootDFE.store();
- showExternalPreviewBFE.store();
+// showExternalPreviewBFE.store();
externalBrowserBFE.store();
externalBrowserSFE.store();
apacheStartSFE.store();
// webSettingsComposite.setLayout(new GridLayout());
// webSettingsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- showExternalPreviewBFE =
- new BooleanFieldEditor(
- IPreferenceConstants.SHOW_EXTERNAL_PREVIEW_PREF,
- PHPPreferencesMessages.getString("PHPBasePreferencePage.websettingsGroup.showexternalpreview"),
- composite);
- showExternalPreviewBFE.setPreferencePage(this);
- showExternalPreviewBFE.setPreferenceStore(getPreferenceStore());
- showExternalPreviewBFE.load();
+// showExternalPreviewBFE =
+// new BooleanFieldEditor(
+// IPreferenceConstants.SHOW_EXTERNAL_PREVIEW_PREF,
+// PHPPreferencesMessages.getString("PHPBasePreferencePage.websettingsGroup.showexternalpreview"),
+// composite);
+// showExternalPreviewBFE.setPreferencePage(this);
+// showExternalPreviewBFE.setPreferenceStore(getPreferenceStore());
+// showExternalPreviewBFE.load();
// Group webSettingsGroup = new Group(webSettingsComposite, SWT.NONE);
// webSettingsGroup.setText(PHPPreferencesMessages.getString("PHPBasePreferencePage.websettingsGroup"));
import java.util.Iterator;
import java.util.List;
import java.util.Set;
+
import net.sourceforge.phpdt.core.JavaCore;
import net.sourceforge.phpdt.externaltools.internal.model.ColorManager;
import net.sourceforge.phpdt.externaltools.internal.model.ExternalToolsPlugin;
import net.sourceforge.phpeclipse.resourcesview.PHPElement;
import net.sourceforge.phpeclipse.resourcesview.PHPElementAdapterFactory;
import net.sourceforge.phpeclipse.resourcesview.ResourceAdapterFactory;
+
import org.eclipse.core.boot.BootLoader;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IAdapterManager;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IPluginDescriptor;
-import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.ui.texteditor.IDocumentProvider;
import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.ConfigurationElementSorter;
+import org.eclipse.ui.texteditor.MarkerAnnotationPreferences;
/**
* The main plugin class to be used in the desktop.
*/
*/
public JavaEditorTextHoverDescriptor[] getJavaEditorTextHoverDescriptors() {
if (fJavaEditorTextHoverDescriptors == null)
- fJavaEditorTextHoverDescriptors = JavaEditorTextHoverDescriptor.getContributedHovers();
- ConfigurationElementSorter sorter= new ConfigurationElementSorter() {
- public IConfigurationElement getConfigurationElement(Object object) {
- return ((JavaEditorTextHoverDescriptor)object).getConfigurationElement();
- }
- };
- sorter.sort(fJavaEditorTextHoverDescriptors);
+ fJavaEditorTextHoverDescriptors = JavaEditorTextHoverDescriptor
+ .getContributedHovers();
return fJavaEditorTextHoverDescriptors;
}
/**
protected void initializeDefaultPreferences(IPreferenceStore store) {
// windows preferences:
store.setDefault(LOCALHOST_PREF, "http://localhost");
- store.setDefault(SHOW_EXTERNAL_PREVIEW_PREF, "true");
+// store.setDefault(SHOW_EXTERNAL_PREVIEW_PREF, "true");
store.setDefault(USE_EXTERNAL_BROWSER_PREF, "false");
store.setDefault(SHOW_OUTPUT_IN_CONSOLE, "true");
+ store.setDefault(PHP_OBFUSCATOR_DEFAULT, "c:\\temp");
+ store.setDefault(PHP_BOOKMARK_DEFAULT, "");
+
+ store.setDefault(PHP_AUTO_PREVIEW_DEFAULT, "true");
+ store.setDefault(PHP_BRING_TO_TOP_PREVIEW_DEFAULT, "true");
+
String windowsSystem = BootLoader.getWS();
if (jvm == WINDOWS_9x) {
store.setDefault(EXTERNAL_BROWSER_PREF,
// TODO How do we start Safari on Mac OS X ?
store.setDefault(EXTERNAL_BROWSER_PREF, "netscape {0}");
} else {
+ store.setDefault(PHP_OBFUSCATOR_DEFAULT, "/tmp");
store.setDefault(EXTERNAL_BROWSER_PREF, "netscape {0}");
}
store.setDefault(DOCUMENTROOT_PREF, getWorkspace().getRoot().getLocation()
JavaCore.initializeDefaultPluginPreferences();
PreferenceConstants.initializeDefaultValues(store);
externalTools.initializeDefaultPreferences(store);
+ MarkerAnnotationPreferences.initializeDefaultValues(store);
}
private IWorkbenchPage internalGetActivePage() {
IWorkbenchWindow window = getWorkbench().getActiveWorkbenchWindow();
ITextSelection selection = (ITextSelection) fEditor.getSelectionProvider().getSelection();
IDocument doc = fEditor.getDocumentProvider().getDocument(fEditor.getEditorInput());
int pos = selection.getOffset();
+ // System.out.println(selection.getText());
String word = getPHPIdentifier(doc, pos);
// System.out.println(word);
if (word != null && !word.equals("")) {
public boolean performFinish() {
return mainPage.finish();
}
+
}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2003 Berthold Daum.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Berthold Daum
+ *******************************************************************************/
+package net.sourceforge.phpeclipse.overlaypages;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.jface.preference.FieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.IPreferenceNode;
+import org.eclipse.jface.preference.IPreferencePage;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceDialog;
+import org.eclipse.jface.preference.PreferenceManager;
+import org.eclipse.jface.preference.PreferenceNode;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IWorkbenchPropertyPage;
+/**
+ * @author Berthold Daum
+ */
+public abstract class FieldEditorOverlayPage extends FieldEditorPreferencePage
+ implements
+ IWorkbenchPropertyPage {
+ /**
+ * * Name of resource property for the selection of workbench or project
+ * settings **
+ */
+ public static final String USEPROJECTSETTINGS = "useProjectSettings"; //$NON-NLS-1$
+ private static final String FALSE = "false"; //$NON-NLS-1$
+ private static final String TRUE = "true"; //$NON-NLS-1$
+ private boolean fUseFileSettings = false;
+ // Stores all created field editors
+ private List editors = new ArrayList();
+ // Stores owning element of properties
+ private IAdaptable element;
+ // Additional buttons for property pages
+ private Button useWorkspaceSettingsButton, useProjectSettingsButton,
+ configureButton;
+ // Overlay preference store for property pages
+ private IPreferenceStore overlayStore;
+ // The image descriptor of this pages title image
+ private ImageDescriptor image;
+ // Cache for page id
+ private String pageId;
+ /**
+ * Constructor
+ *
+ * @param style -
+ * layout style
+ */
+ public FieldEditorOverlayPage(int style) {
+ super(style);
+ }
+ /**
+ * Constructor
+ *
+ * @param style -
+ * layout style
+ */
+ public FieldEditorOverlayPage(int style, boolean isFileSettings) {
+ super(style);
+ fUseFileSettings = isFileSettings;
+ }
+ /**
+ * Constructor
+ *
+ * @param title -
+ * title string
+ * @param style -
+ * layout style
+ */
+ public FieldEditorOverlayPage(String title, int style) {
+ super(title, style);
+ }
+ public FieldEditorOverlayPage(String title, int style, boolean isFileSettings) {
+ super(title, style);
+ fUseFileSettings = isFileSettings;
+ }
+ /**
+ * Constructor
+ *
+ * @param title -
+ * title string
+ * @param image -
+ * title image
+ * @param style -
+ * layout style
+ */
+ public FieldEditorOverlayPage(String title, ImageDescriptor image, int style) {
+ super(title, image, style);
+ this.image = image;
+ }
+ /**
+ * Returns the id of the current preference page as defined in plugin.xml
+ * Subclasses must implement.
+ *
+ * @return - the qualifier
+ */
+ protected abstract String getPageId();
+ /**
+ * Receives the object that owns the properties shown in this property page.
+ *
+ * @see org.eclipse.ui.IWorkbenchPropertyPage#setElement(org.eclipse.core.runtime.IAdaptable)
+ */
+ public void setElement(IAdaptable element) {
+ this.element = element;
+ }
+ /**
+ * Delivers the object that owns the properties shown in this property page.
+ *
+ * @see org.eclipse.ui.IWorkbenchPropertyPage#getElement()
+ */
+ public IAdaptable getElement() {
+ return element;
+ }
+ /**
+ * Returns true if this instance represents a property page
+ *
+ * @return - true for property pages, false for preference pages
+ */
+ public boolean isPropertyPage() {
+ return getElement() != null;
+ }
+ /**
+ * We override the addField method. This allows us to store each field editor
+ * added by subclasses in a list for later processing.
+ *
+ * @see org.eclipse.jface.preference.FieldEditorPreferencePage#addField(org.eclipse.jface.preference.FieldEditor)
+ */
+ protected void addField(FieldEditor editor) {
+ editors.add(editor);
+ super.addField(editor);
+ }
+ /**
+ * We override the createControl method. In case of property pages we create
+ * a new PropertyStore as local preference store. After all control have been
+ * create, we enable/disable these controls.
+ *
+ * @see org.eclipse.jface.preference.PreferencePage#createControl()
+ */
+ public void createControl(Composite parent) {
+ // Special treatment for property pages
+ if (isPropertyPage()) {
+ // Cache the page id
+ pageId = getPageId();
+ // Create an overlay preference store and fill it with properties
+ overlayStore = new PropertyStore((IResource) getElement(), super
+ .getPreferenceStore(), pageId);
+ // Set overlay store as current preference store
+ }
+ super.createControl(parent);
+ // Update state of all subclass controls
+ if (isPropertyPage())
+ updateFieldEditors();
+ }
+ /**
+ * We override the createContents method. In case of property pages we insert
+ * two radio buttons at the top of the page.
+ *
+ * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createContents(Composite parent) {
+ if (isPropertyPage())
+ createSelectionGroup(parent);
+ return super.createContents(parent);
+ }
+ /**
+ * Creates and initializes a selection group with two choice buttons and one
+ * push button.
+ *
+ * @param parent -
+ * the parent composite
+ */
+ private void createSelectionGroup(Composite parent) {
+ Composite comp = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(2, false);
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ comp.setLayout(layout);
+ comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ Composite radioGroup = new Composite(comp, SWT.NONE);
+ radioGroup.setLayout(new GridLayout());
+ radioGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ useWorkspaceSettingsButton = createRadioButton(radioGroup, Messages
+ .getString("OverlayPage.Use_Workspace_Settings")); //$NON-NLS-1$
+ if (fUseFileSettings) {
+ useProjectSettingsButton = createRadioButton(radioGroup, Messages
+ .getString("OverlayPage.Use_File_Settings")); //$NON-NLS-1$
+ } else {
+ useProjectSettingsButton = createRadioButton(radioGroup, Messages
+ .getString("OverlayPage.Use_Project_Settings")); //$NON-NLS-1$
+ }
+ configureButton = new Button(comp, SWT.PUSH);
+ configureButton.setText(Messages
+ .getString("OverlayPage.Configure_Workspace_Settings")); //$NON-NLS-1$
+ configureButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ configureWorkspaceSettings();
+ }
+ });
+ // Set workspace/project radio buttons
+ try {
+ String use = ((IResource) getElement())
+ .getPersistentProperty(new QualifiedName(pageId, USEPROJECTSETTINGS));
+ if (TRUE.equals(use)) {
+ useProjectSettingsButton.setSelection(true);
+ configureButton.setEnabled(false);
+ } else
+ useWorkspaceSettingsButton.setSelection(true);
+ } catch (CoreException e) {
+ useWorkspaceSettingsButton.setSelection(true);
+ }
+ }
+ /**
+ * Convenience method creating a radio button
+ *
+ * @param parent -
+ * the parent composite
+ * @param label -
+ * the button label
+ * @return - the new button
+ */
+ private Button createRadioButton(Composite parent, String label) {
+ final Button button = new Button(parent, SWT.RADIO);
+ button.setText(label);
+ button.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ configureButton.setEnabled(button == useWorkspaceSettingsButton);
+ updateFieldEditors();
+ }
+ });
+ return button;
+ }
+ /**
+ * Returns in case of property pages the overlay store, in case of preference
+ * pages the standard preference store
+ *
+ * @see org.eclipse.jface.preference.PreferencePage#getPreferenceStore()
+ */
+ public IPreferenceStore getPreferenceStore() {
+ if (isPropertyPage())
+ return overlayStore;
+ return super.getPreferenceStore();
+ }
+ /*
+ * Enables or disables the field editors and buttons of this page
+ */
+ private void updateFieldEditors() {
+ // We iterate through all field editors
+ boolean enabled = useProjectSettingsButton.getSelection();
+ updateFieldEditors(enabled);
+ }
+ /**
+ * Enables or disables the field editors and buttons of this page Subclasses
+ * may override.
+ *
+ * @param enabled -
+ * true if enabled
+ */
+ protected void updateFieldEditors(boolean enabled) {
+ Composite parent = getFieldEditorParent();
+ Iterator it = editors.iterator();
+ while (it.hasNext()) {
+ FieldEditor editor = (FieldEditor) it.next();
+ editor.setEnabled(enabled, parent);
+ }
+ }
+ /**
+ * We override the performOk method. In case of property pages we copy the
+ * values in the overlay store into the property values of the selected
+ * project. We also save the state of the radio buttons.
+ *
+ * @see org.eclipse.jface.preference.IPreferencePage#performOk()
+ */
+ public boolean performOk() {
+ boolean result = super.performOk();
+ if (result && isPropertyPage()) {
+ // Save state of radiobuttons in project properties
+ IResource resource = (IResource) getElement();
+ try {
+ String value = (useProjectSettingsButton.getSelection()) ? TRUE : FALSE;
+ resource.setPersistentProperty(new QualifiedName(pageId,
+ USEPROJECTSETTINGS), value);
+ } catch (CoreException e) {
+ }
+ }
+ return result;
+ }
+ /**
+ * We override the performDefaults method. In case of property pages we
+ * switch back to the workspace settings and disable the field editors.
+ *
+ * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
+ */
+ protected void performDefaults() {
+ if (isPropertyPage()) {
+ useWorkspaceSettingsButton.setSelection(true);
+ useProjectSettingsButton.setSelection(false);
+ configureButton.setEnabled(true);
+ updateFieldEditors();
+ }
+ super.performDefaults();
+ }
+ /**
+ * Creates a new preferences page and opens it
+ *
+ * @see com.bdaum.SpellChecker.preferences.SpellCheckerPreferencePage#configureWorkspaceSettings()
+ */
+ protected void configureWorkspaceSettings() {
+ try {
+ // create a new instance of the current class
+ IPreferencePage page = (IPreferencePage) this.getClass().newInstance();
+ page.setTitle(getTitle());
+ page.setImageDescriptor(image);
+ // and show it
+ showPreferencePage(pageId, page);
+ } catch (InstantiationException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ }
+ /**
+ * Show a single preference pages
+ *
+ * @param id -
+ * the preference page identification
+ * @param page -
+ * the preference page
+ */
+ protected void showPreferencePage(String id, IPreferencePage page) {
+ final IPreferenceNode targetNode = new PreferenceNode(id, page);
+ PreferenceManager manager = new PreferenceManager();
+ manager.addToRoot(targetNode);
+ final PreferenceDialog dialog = new PreferenceDialog(getControl()
+ .getShell(), manager);
+ BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() {
+ public void run() {
+ dialog.create();
+ dialog.setMessage(targetNode.getLabelText());
+ dialog.open();
+ }
+ });
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2003 Berthold Daum.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Berthold Daum
+ *******************************************************************************/
+
+package net.sourceforge.phpeclipse.overlaypages;
+
+import java.util.ResourceBundle;
+
+
+public class Messages {
+
+ private final static String RESOURCE_BUNDLE= "com.bdaum.overlayPages.Messages";//$NON-NLS-1$
+
+ private static ResourceBundle fgResourceBundle = null;
+
+ private static boolean notRead = true;
+
+ public Messages() {
+ }
+ public static ResourceBundle getResourceBundle() {
+ if (notRead) {
+ notRead = false;
+ try {
+ fgResourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
+ }
+ catch (Exception e) {
+ }
+ }
+
+ return fgResourceBundle;
+ }
+ public static String getString(String key) {
+ try {
+ return getResourceBundle().getString(key);
+ } catch (Exception e) {
+ return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
+ }
+ }
+}
+
--- /dev/null
+OverlayPage.Use_Workspace_Settings=Use &workspace settings
+OverlayPage.Use_Project_Settings=Use pr&oject settings
+OverlayPage.Use_File_Settings=Use &file settings
+OverlayPage.Configure_Workspace_Settings=&Configure Workspace Settings ...
+PropertyStore.Cannot_write_resource_property=Cannot write resource property
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2003 Berthold Daum.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Berthold Daum
+ *******************************************************************************/
+package net.sourceforge.phpeclipse.overlaypages;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.jface.preference.IPreferenceNode;
+import org.eclipse.jface.preference.IPreferencePage;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceDialog;
+import org.eclipse.jface.preference.PreferenceManager;
+import org.eclipse.jface.preference.PreferenceNode;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.custom.CTabFolder;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.ui.dialogs.PropertyPage;
+import org.eclipse.ui.part.PageBook;
+
+/**
+ * @author Berthold Daum
+ */
+public abstract class OverlayPage extends PropertyPage {
+
+ /*** Name of resource property for the selection of workbench or project settings ***/
+ public static final String USEPROJECTSETTINGS = "useProjectSettings"; //$NON-NLS-1$
+
+ private static final String FALSE = "false"; //$NON-NLS-1$
+ private static final String TRUE = "true"; //$NON-NLS-1$
+
+ // Additional buttons for property pages
+ private Button useWorkspaceSettingsButton,
+ useProjectSettingsButton,
+ configureButton;
+
+ // Overlay preference store for property pages
+ private PropertyStore overlayStore;
+
+ // The image descriptor of this pages title image
+ private ImageDescriptor image;
+
+ // Cache for page id
+ private String pageId;
+
+ // Container for subclass controls
+ private Composite contents;
+
+ /**
+ * Constructor
+ */
+ public OverlayPage() {
+ super();
+ }
+
+ /**
+ * Constructor
+ * @param title - title string
+ */
+ public OverlayPage(String title) {
+ super();
+ setTitle(title);
+ }
+
+ /**
+ * Constructor
+ * @param title - title string
+ * @param image - title image
+ */
+ public OverlayPage(String title, ImageDescriptor image) {
+ super();
+ setTitle(title);
+ setImageDescriptor(image);
+ this.image = image;
+ }
+
+ /**
+ * Returns the id of the current preference page as defined in plugin.xml
+ * Subclasses must implement.
+ *
+ * @return - the qualifier
+ */
+ protected abstract String getPageId();
+
+ /**
+ * Returns true if this instance represents a property page
+ * @return - true for property pages, false for preference pages
+ */
+ public boolean isPropertyPage() {
+ return getElement() != null;
+ }
+
+ /**
+ * We need to implement createContents method. In case of property pages we insert two radio buttons
+ * and a push button at the top of the page. Below this group we create a new composite for the contents
+ * created by subclasses.
+ *
+ * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createContents(Composite parent) {
+ if (isPropertyPage())
+ createSelectionGroup(parent);
+ contents = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ contents.setLayout(layout);
+ contents.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ return contents;
+ }
+
+ /**
+ * Creates and initializes a selection group with two choice buttons and one push button.
+ * @param parent - the parent composite
+ */
+ private void createSelectionGroup(Composite parent) {
+ Composite comp = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(2, false);
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ comp.setLayout(layout);
+ comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ Composite radioGroup = new Composite(comp, SWT.NONE);
+ radioGroup.setLayout(new GridLayout());
+ radioGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ useWorkspaceSettingsButton = createRadioButton(radioGroup, Messages.getString("OverlayPage.Use_Workspace_Settings")); //$NON-NLS-1$
+ useProjectSettingsButton = createRadioButton(radioGroup, Messages.getString("OverlayPage.Use_Project_Settings")); //$NON-NLS-1$
+ configureButton = new Button(comp, SWT.PUSH);
+ configureButton.setText(Messages.getString("OverlayPage.Configure_Workspace_Settings")); //$NON-NLS-1$
+ configureButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ configureWorkspaceSettings();
+ }
+ });
+ // Set workspace/project radio buttons
+ try {
+ String use =
+ ((IResource) getElement()).getPersistentProperty(
+ new QualifiedName(pageId, USEPROJECTSETTINGS));
+ if (TRUE.equals(use)) {
+ useProjectSettingsButton.setSelection(true);
+ configureButton.setEnabled(false);
+ } else
+ useWorkspaceSettingsButton.setSelection(true);
+ } catch (CoreException e) {
+ useWorkspaceSettingsButton.setSelection(true);
+ }
+ }
+
+ /**
+ * Convenience method creating a radio button
+ * @param parent - the parent composite
+ * @param label - the button label
+ * @return - the new button
+ */
+ private Button createRadioButton(Composite parent, String label) {
+ final Button button = new Button(parent, SWT.RADIO);
+ button.setText(label);
+ button.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ configureButton.setEnabled(
+ button == useWorkspaceSettingsButton);
+ setControlsEnabled();
+ }
+ });
+ return button;
+ }
+
+ /**
+ * In case of property pages we create a new PropertyStore as local overlay store.
+ * After all controls have been create, we enable/disable these controls
+ *
+ * @see org.eclipse.jface.preference.PreferencePage#createControl()
+ */
+ public void createControl(Composite parent) {
+ // Special treatment for property pages
+ if (isPropertyPage()) {
+ // Cache the page id
+ pageId = getPageId();
+ // Create an overlay preference store and fill it with properties
+ overlayStore =
+ new PropertyStore(
+ (IResource) getElement(),
+ super.getPreferenceStore(),
+ pageId);
+ // Set overlay store as current preference store
+ }
+ super.createControl(parent);
+ // Update enablement of all subclass controls
+ if (isPropertyPage())
+ setControlsEnabled();
+ }
+
+ /*
+ * Returns in case of property pages the overlay store - otherwise the standard preference store
+ * @see org.eclipse.jface.preference.PreferencePage#getPreferenceStore()
+ */
+ public IPreferenceStore getPreferenceStore() {
+ if (isPropertyPage())
+ return overlayStore;
+ return super.getPreferenceStore();
+ }
+
+ /**
+ * Enables or disables the controls of this page
+ */
+ private void setControlsEnabled() {
+ boolean enabled = useProjectSettingsButton.getSelection();
+ setControlsEnabled(enabled);
+ }
+
+ /**
+ * Enables or disables the controls of this page
+ * Subclasses may override.
+ *
+ * @param enabled - true if controls shall be enabled
+ */
+ protected void setControlsEnabled(boolean enabled) {
+ setControlsEnabled(contents, enabled);
+ }
+
+ /**
+ * Enables or disables a tree of controls starting at the specified root.
+ * We spare tabbed notebooks and pagebooks to allow for user navigation.
+ *
+ * @param root - the root composite
+ * @param enabled - true if controls shall be enabled
+ */
+ private void setControlsEnabled(Composite root, boolean enabled) {
+ Control[] children = root.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ Control child = children[i];
+ if (!(child instanceof CTabFolder) && !(child instanceof TabFolder) && !(child instanceof PageBook))
+ child.setEnabled(enabled);
+ if (child instanceof Composite)
+ setControlsEnabled((Composite) child, enabled);
+ }
+ }
+
+ /**
+ * We override the performOk method. In case of property pages
+ * we save the state of the radio buttons.
+ *
+ * @see org.eclipse.jface.preference.IPreferencePage#performOk()
+ */
+ public boolean performOk() {
+ boolean result = super.performOk();
+ if (result && isPropertyPage()) {
+ // Save state of radiobuttons in project properties
+ IResource resource = (IResource) getElement();
+ try {
+ String value =
+ (useProjectSettingsButton.getSelection()) ? TRUE : FALSE;
+ resource.setPersistentProperty(
+ new QualifiedName(pageId, USEPROJECTSETTINGS),
+ value);
+ } catch (CoreException e) {
+ }
+ }
+ return result;
+ }
+
+ /**
+ * We override the performDefaults method. In case of property pages we
+ * switch back to the workspace settings and disable the page controls.
+ *
+ * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
+ */
+ protected void performDefaults() {
+ if (isPropertyPage()) {
+ useWorkspaceSettingsButton.setSelection(true);
+ useProjectSettingsButton.setSelection(false);
+ configureButton.setEnabled(true);
+ setControlsEnabled();
+ }
+ super.performDefaults();
+ }
+
+ /**
+ * Creates a new preferences page and opens it
+ * @see com.bdaum.SpellChecker.preferences.SpellCheckerPreferencePage#configureWorkspaceSettings()
+ */
+ protected void configureWorkspaceSettings() {
+ try {
+ // create a new instance of the current class
+ IPreferencePage page =
+ (IPreferencePage) this.getClass().newInstance();
+ page.setTitle(getTitle());
+ page.setImageDescriptor(image);
+ // and show it
+ showPreferencePage(pageId, page);
+ } catch (InstantiationException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Show a single preference pages
+ * @param id - the preference page identification
+ * @param page - the preference page
+ */
+ protected void showPreferencePage(String id, IPreferencePage page) {
+ final IPreferenceNode targetNode = new PreferenceNode(id, page);
+ PreferenceManager manager = new PreferenceManager();
+ manager.addToRoot(targetNode);
+ final PreferenceDialog dialog =
+ new PreferenceDialog(getControl().getShell(), manager);
+ BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() {
+ public void run() {
+ dialog.create();
+ dialog.setMessage(targetNode.getLabelText());
+ dialog.open();
+ }
+ });
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2003 Berthold Daum.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Berthold Daum
+ *******************************************************************************/
+
+package net.sourceforge.phpeclipse.overlaypages;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceStore;
+
+/**
+ * @author Berthold Daum
+ *
+ */
+public class PropertyStore extends PreferenceStore {
+
+ private IResource resource;
+ private IPreferenceStore workbenchStore;
+ private String pageId;
+ private boolean inserting = false;
+
+ public PropertyStore(
+ IResource resource,
+ IPreferenceStore workbenchStore,
+ String pageId) {
+ this.resource = resource;
+ this.workbenchStore = workbenchStore;
+ this.pageId = pageId;
+ }
+
+ /*** Write modified values back to properties ***/
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPersistentPreferenceStore#save()
+ */
+ public void save() throws IOException {
+ writeProperties();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.PreferenceStore#save(java.io.OutputStream, java.lang.String)
+ */
+ public void save(OutputStream out, String header) throws IOException {
+ writeProperties();
+ }
+
+ /**
+ * Writes modified preferences into resource properties.
+ */
+ private void writeProperties() throws IOException {
+ String[] preferences = super.preferenceNames();
+ for (int i = 0; i < preferences.length; i++) {
+ String name = preferences[i];
+ try {
+ setProperty(name, getString(name));
+ } catch (CoreException e) {
+ throw new IOException(Messages.getString("PropertyStore.Cannot_write_resource_property") + name); //$NON-NLS-1$
+ }
+ }
+ }
+
+ /**
+ * Convenience method to set a property
+ * @param name - the preference name
+ * @param value - the property value or null to delete the property
+ * @throws CoreException
+ */
+ private void setProperty(String name, String value) throws CoreException {
+ resource.setPersistentProperty(new QualifiedName(pageId, name), value);
+ }
+
+ /*** Get default values (Delegate to workbench store) ***/
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultBoolean(java.lang.String)
+ */
+ public boolean getDefaultBoolean(String name) {
+ return workbenchStore.getDefaultBoolean(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultDouble(java.lang.String)
+ */
+ public double getDefaultDouble(String name) {
+ return workbenchStore.getDefaultDouble(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultFloat(java.lang.String)
+ */
+ public float getDefaultFloat(String name) {
+ return workbenchStore.getDefaultFloat(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultInt(java.lang.String)
+ */
+ public int getDefaultInt(String name) {
+ return workbenchStore.getDefaultInt(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultLong(java.lang.String)
+ */
+ public long getDefaultLong(String name) {
+ return workbenchStore.getDefaultLong(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultString(java.lang.String)
+ */
+ public String getDefaultString(String name) {
+ return workbenchStore.getDefaultString(name);
+ }
+
+ /*** Get property values ***/
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#getBoolean(java.lang.String)
+ */
+ public boolean getBoolean(String name) {
+ insertValue(name);
+ return super.getBoolean(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#getDouble(java.lang.String)
+ */
+ public double getDouble(String name) {
+ insertValue(name);
+ return super.getDouble(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#getFloat(java.lang.String)
+ */
+ public float getFloat(String name) {
+ insertValue(name);
+ return super.getFloat(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#getInt(java.lang.String)
+ */
+ public int getInt(String name) {
+ insertValue(name);
+ return super.getInt(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#getLong(java.lang.String)
+ */
+ public long getLong(String name) {
+ insertValue(name);
+ return super.getLong(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#getString(java.lang.String)
+ */
+ public String getString(String name) {
+ insertValue(name);
+ return super.getString(name);
+ }
+
+ /**
+ * @param name
+ */
+ private synchronized void insertValue(String name) {
+ if (inserting)
+ return;
+ if (super.contains(name))
+ return;
+ inserting = true;
+ String prop = null;
+ try {
+ prop = getProperty(name);
+ } catch (CoreException e) {
+ }
+ if (prop == null)
+ prop = workbenchStore.getString(name);
+ if (prop != null)
+ setValue(name, prop);
+ inserting = false;
+ }
+
+ /**
+ * Convenience method to fetch a property
+ * @param name - the preference name
+ * @return - the property value
+ * @throws CoreException
+ */
+ private String getProperty(String name) throws CoreException {
+ return resource.getPersistentProperty(new QualifiedName(pageId, name));
+ }
+
+ /*** Misc ***/
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#contains(java.lang.String)
+ */
+ public boolean contains(String name) {
+ return workbenchStore.contains(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#setToDefault(java.lang.String)
+ */
+ public void setToDefault(String name) {
+ setValue(name, getDefaultString(name));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#isDefault(java.lang.String)
+ */
+ public boolean isDefault(String name) {
+ String defaultValue = getDefaultString(name);
+ if (defaultValue == null) return false;
+ return defaultValue.equals(getString(name));
+ }
+
+}
--- /dev/null
+package net.sourceforge.phpeclipse.overlaypages;
+import net.sourceforge.phpeclipse.PHPeclipsePlugin;
+import net.sourceforge.phpeclipse.preferences.PHPMiscProjectPreferences;
+import net.sourceforge.phpeclipse.preferences.PHPPreviewProjectPreferences;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.QualifiedName;
+
+public class Util {
+ public static String getMiscProjectsPreferenceValue(IResource resource, String key) {
+ return getOverlayedPrefProjectValue(resource,
+ PHPMiscProjectPreferences.PREF_ID, key);
+ }
+ public static String getOverlayedPrefProjectValue(IResource resource,
+ String pageId, String key) {
+ IProject project = resource.getProject();
+ String value = null;
+ if (useProjectSettings(project, pageId)) {
+ value = getProperty(resource, pageId, key);
+ }
+ if (value != null)
+ return value;
+ return PHPeclipsePlugin.getDefault().getPreferenceStore().getString(key);
+ }
+ public static String getOverlayedPrefResourceValue(IResource resource,
+ String pageId, String key) {
+ String value = null;
+ if (useProjectSettings(resource, pageId)) {
+ value = getProperty(resource, pageId, key);
+ }
+ if (value != null)
+ return value;
+ return PHPeclipsePlugin.getDefault().getPreferenceStore().getString(key);
+ }
+ public static boolean getPreviewBooleanValue(IResource resource, String key) {
+ return getOverlayedPrefResourceValue(resource,
+ PHPPreviewProjectPreferences.PREF_ID, key).equals("true");
+ }
+ public static String getPreviewStringValue(IResource resource, String key) {
+ return getOverlayedPrefResourceValue(resource,
+ PHPPreviewProjectPreferences.PREF_ID, key);
+ }
+ private static String getProperty(IResource resource, String pageId,
+ String key) {
+ try {
+ return resource.getPersistentProperty(new QualifiedName(pageId, key));
+ } catch (CoreException e) {
+ }
+ return null;
+ }
+ private static boolean useProjectSettings(IResource resource, String pageId) {
+ String use = getProperty(resource, pageId,
+ FieldEditorOverlayPage.USEPROJECTSETTINGS);
+ return "true".equals(use);
+ }
+}
public class JavaMarkerAnnotation extends MarkerAnnotation implements IJavaAnnotation {
- public static final String JAVA_MARKER_TYPE_PREFIX= "org.eclipse.jdt"; //$NON-NLS-1$
- public static final String ERROR_ANNOTATION_TYPE= "org.eclipse.jdt.ui.error"; //$NON-NLS-1$
- public static final String WARNING_ANNOTATION_TYPE= "org.eclipse.jdt.ui.warning"; //$NON-NLS-1$
- public static final String INFO_ANNOTATION_TYPE= "org.eclipse.jdt.ui.info"; //$NON-NLS-1$
+// public static final String JAVA_MARKER_TYPE_PREFIX= "net.sourceforge.phpdt"; //$NON-NLS-1$
+ public static final String ERROR_ANNOTATION_TYPE= "net.sourceforge.phpdt.ui.error"; //$NON-NLS-1$
+ public static final String WARNING_ANNOTATION_TYPE= "net.sourceforge.phpdt.ui.warning"; //$NON-NLS-1$
+ public static final String INFO_ANNOTATION_TYPE= "net.sourceforge.phpdt.ui.info"; //$NON-NLS-1$
public static final String TASK_ANNOTATION_TYPE= "org.eclipse.ui.workbench.texteditor.task"; //$NON-NLS-1$
private IJavaAnnotation fOverlay;
package net.sourceforge.phpeclipse.phpeditor;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
- Klaus Hartlage - www.eclipseproject.de
-**********************************************************************/
-
+/*******************************************************************************
+ * Copyright (c) 2000, 2002 IBM Corp. and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Common Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors: IBM Corporation - Initial implementation Klaus Hartlage -
+ * www.eclipseproject.de
+ ******************************************************************************/
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.ResourceBundle;
-
import net.sourceforge.phpdt.ui.IContextMenuConstants;
import net.sourceforge.phpdt.ui.actions.GotoMatchingBracketAction;
import net.sourceforge.phpdt.ui.actions.PHPdtActionConstants;
import net.sourceforge.phpeclipse.PHPeclipsePlugin;
-
import org.eclipse.core.resources.IFile;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
import org.eclipse.ui.texteditor.RetargetTextEditorAction;
/**
- * Contributes interesting PHP actions to the desktop's Edit menu and the toolbar.
+ * Contributes interesting PHP actions to the desktop's Edit menu and the
+ * toolbar.
*/
public class PHPActionContributor extends BasicTextEditorActionContributor {
-
protected RetargetTextEditorAction fContentAssistTip;
// protected TextEditorAction fTogglePresentation;
protected RetargetAction fRetargetContentAssist;
-
protected RetargetTextEditorAction fContentAssist;
private RetargetTextEditorAction fGotoMatchingBracket;
private List fRetargetToolbarActions = new ArrayList();
private List fPartListeners = new ArrayList();
-
protected PHPParserAction fParserAction;
protected ShowExternalPreviewAction fShowExternalPreviewAction;
-
private EncodingActionGroup fEncodingActionGroup;
/**
* Default constructor.
*/
public PHPActionContributor() {
super();
-
ResourceBundle b = PHPEditorMessages.getResourceBundle();
-
- fRetargetContentAssist = new RetargetAction(PHPdtActionConstants.CONTENT_ASSIST, PHPEditorMessages.getString("ContentAssistProposal.label")); //$NON-NLS-1$
- fRetargetContentAssist.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
+ fRetargetContentAssist = new RetargetAction(
+ PHPdtActionConstants.CONTENT_ASSIST, PHPEditorMessages
+ .getString("ContentAssistProposal.label")); //$NON-NLS-1$
+ fRetargetContentAssist
+ .setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
markAsPartListener(fRetargetContentAssist);
-
fContentAssist = new RetargetTextEditorAction(b, "ContentAssistProposal."); //$NON-NLS-1$
- fContentAssist.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
-
- fGotoMatchingBracket = new RetargetTextEditorAction(b, "GotoMatchingBracket."); //$NON-NLS-1$
- fGotoMatchingBracket.setActionDefinitionId(PHPEditorActionDefinitionIds.GOTO_MATCHING_BRACKET);
-
+ fContentAssist
+ .setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
+ fGotoMatchingBracket = new RetargetTextEditorAction(b,
+ "GotoMatchingBracket."); //$NON-NLS-1$
+ fGotoMatchingBracket
+ .setActionDefinitionId(PHPEditorActionDefinitionIds.GOTO_MATCHING_BRACKET);
// fContentAssist.setImageDescriptor(JavaPluginImages.DESC_CLCL_CODE_ASSIST);
// fContentAssist.setDisabledImageDescriptor(JavaPluginImages.DESC_DLCL_CODE_ASSIST);
-
- // fContentAssist = new RetargetTextEditorAction(PHPEditorMessages.getResourceBundle(), "ContentAssistProposal."); //$NON-NLS-1$
- fContentAssistTip = new RetargetTextEditorAction(PHPEditorMessages.getResourceBundle(), "ContentAssistTip."); //$NON-NLS-1$
+ // fContentAssist = new
+ // RetargetTextEditorAction(PHPEditorMessages.getResourceBundle(),
+ // "ContentAssistProposal."); //$NON-NLS-1$
+ fContentAssistTip = new RetargetTextEditorAction(PHPEditorMessages
+ .getResourceBundle(), "ContentAssistTip."); //$NON-NLS-1$
// fTogglePresentation = new PresentationAction();
-
// character encoding
fEncodingActionGroup = new EncodingActionGroup();
-
fParserAction = PHPParserAction.getInstance();
-
if (SWT.getPlatform().equals("win32")) {
// ExternalPreview only available as ActiveX on win32 (Eclipse2.1)
fShowExternalPreviewAction = ShowExternalPreviewAction.getInstance();
}
}
-
protected final void markAsPartListener(RetargetAction action) {
fPartListeners.add(action);
}
-
/*
* @see EditorActionBarContributor#contributeToMenu(IMenuManager)
*/
- // public void contributeToMenu(IMenuManager menu) {
+ // public void contributeToMenu(IMenuManager menu) {
// super.contributeToMenu(menu);
- // IMenuManager editMenu= menu.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
+ // IMenuManager editMenu=
+ // menu.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
// if (editMenu != null) {
- // MenuManager structureSelection= new MenuManager(JavaEditorMessages.getString("ExpandSelectionMenu.label")); //$NON-NLS-1$
+ // MenuManager structureSelection= new
+ // MenuManager(JavaEditorMessages.getString("ExpandSelectionMenu.label"));
+ // //$NON-NLS-1$
// structureSelection.add(fStructureSelectEnclosingAction);
// structureSelection.add(fStructureSelectNextAction);
// structureSelection.add(fStructureSelectPreviousAction);
// structureSelection.add(fStructureSelectHistoryAction);
- // editMenu.appendToGroup(IContextMenuConstants.GROUP_OPEN, structureSelection);
- // editMenu.appendToGroup(IContextMenuConstants.GROUP_OPEN, fGotoPreviousMemberAction);
- // editMenu.appendToGroup(IContextMenuConstants.GROUP_OPEN, fGotoNextMemberAction);
- // editMenu.appendToGroup(IContextMenuConstants.GROUP_OPEN, fGotoMatchingBracket);
-
- // editMenu.appendToGroup(IContextMenuConstants.GROUP_GENERATE, fShowOutline);
+ // editMenu.appendToGroup(IContextMenuConstants.GROUP_OPEN,
+ // structureSelection);
+ // editMenu.appendToGroup(IContextMenuConstants.GROUP_OPEN,
+ // fGotoPreviousMemberAction);
+ // editMenu.appendToGroup(IContextMenuConstants.GROUP_OPEN,
+ // fGotoNextMemberAction);
+ // editMenu.appendToGroup(IContextMenuConstants.GROUP_OPEN,
+ // fGotoMatchingBracket);
+ // editMenu.appendToGroup(IContextMenuConstants.GROUP_GENERATE,
+ // fShowOutline);
// }
// }
/*
//
// super.contributeToMenu(menu);
//
- // IMenuManager editMenu= menu.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
+ // IMenuManager editMenu=
+ // menu.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
// if (editMenu != null) {
// editMenu.add(new Separator(IContextMenuConstants.GROUP_OPEN));
// editMenu.add(new Separator(IContextMenuConstants.GROUP_GENERATE));
//
- // editMenu.appendToGroup(IContextMenuConstants.GROUP_GENERATE, fRetargetContentAssist);
- // }
+ // editMenu.appendToGroup(IContextMenuConstants.GROUP_GENERATE,
+ // fRetargetContentAssist);
+ // }
// }
-
/*
- * @see org.eclipse.ui.part.EditorActionBarContributor#contributeToMenu(org.eclipse.jface.action.IMenuManager)
- */
+ * @see org.eclipse.ui.part.EditorActionBarContributor#contributeToMenu(org.eclipse.jface.action.IMenuManager)
+ */
public void contributeToMenu(IMenuManager menu) {
-
super.contributeToMenu(menu);
-
- IMenuManager editMenu = menu.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
+ IMenuManager editMenu = menu
+ .findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
if (editMenu != null) {
editMenu.add(new Separator(IContextMenuConstants.GROUP_OPEN));
editMenu.add(new Separator(IContextMenuConstants.GROUP_GENERATE));
editMenu.add(new Separator(IContextMenuConstants.GROUP_ADDITIONS));
-
// editMenu.appendToGroup(
// IContextMenuConstants.GROUP_GENERATE,
// fRetargetContentAssist);
-
- // MenuManager structureSelection= new MenuManager(JavaEditorMessages.getString("ExpandSelectionMenu.label"), "expandSelection"); //$NON-NLS-1$ //$NON-NLS-2$
+ // MenuManager structureSelection= new
+ // MenuManager(JavaEditorMessages.getString("ExpandSelectionMenu.label"),
+ // "expandSelection"); //$NON-NLS-1$ //$NON-NLS-2$
// structureSelection.add(fStructureSelectEnclosingAction);
// structureSelection.add(fStructureSelectNextAction);
// structureSelection.add(fStructureSelectPreviousAction);
// structureSelection.add(fStructureSelectHistoryAction);
- // editMenu.appendToGroup(IContextMenuConstants.GROUP_OPEN, structureSelection);
-
- // editMenu.appendToGroup(IContextMenuConstants.GROUP_GENERATE, fRetargetShowJavaDoc);
+ // editMenu.appendToGroup(IContextMenuConstants.GROUP_OPEN,
+ // structureSelection);
+ // editMenu.appendToGroup(IContextMenuConstants.GROUP_GENERATE,
+ // fRetargetShowJavaDoc);
}
-
- // IMenuManager navigateMenu= menu.findMenuUsingPath(IWorkbenchActionConstants.M_NAVIGATE);
+ // IMenuManager navigateMenu=
+ // menu.findMenuUsingPath(IWorkbenchActionConstants.M_NAVIGATE);
// if (navigateMenu != null) {
- // navigateMenu.appendToGroup(IWorkbenchActionConstants.SHOW_EXT, fShowOutline);
+ // navigateMenu.appendToGroup(IWorkbenchActionConstants.SHOW_EXT,
+ // fShowOutline);
// }
-
IMenuManager gotoMenu = menu.findMenuUsingPath("navigate/goTo"); //$NON-NLS-1$
if (gotoMenu != null) {
gotoMenu.add(new Separator("additions2")); //$NON-NLS-1$
- // gotoMenu.appendToGroup("additions2", fGotoPreviousMemberAction); //$NON-NLS-1$
- // gotoMenu.appendToGroup("additions2", fGotoNextMemberAction); //$NON-NLS-1$
+ // gotoMenu.appendToGroup("additions2", fGotoPreviousMemberAction);
+ // //$NON-NLS-1$
+ // gotoMenu.appendToGroup("additions2", fGotoNextMemberAction);
+ // //$NON-NLS-1$
gotoMenu.appendToGroup("additions2", fGotoMatchingBracket); //$NON-NLS-1$
}
}
while (e.hasNext())
tbm.add((IAction) e.next());
}
-
/*
* @see IEditorActionBarContributor#init(IActionBars, IWorkbenchPage)
*/
*/
public void init(IActionBars bars) {
super.init(bars);
-
IMenuManager menuManager = bars.getMenuManager();
- IMenuManager editMenu = menuManager.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
+ IMenuManager editMenu = menuManager
+ .findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
if (editMenu != null) {
editMenu.add(new Separator());
editMenu.add(fContentAssist);
// editMenu.add(fGotoMatchingBracket);
// editMenu.add(fContentAssistTip);
}
-
- bars.setGlobalActionHandler(PHPdtActionConstants.CONTENT_ASSIST, fContentAssist);
+ bars.setGlobalActionHandler(PHPdtActionConstants.CONTENT_ASSIST,
+ fContentAssist);
// IToolBarManager toolBarManager = bars.getToolBarManager();
// if (toolBarManager != null) {
// toolBarManager.add(new Separator());
// toolBarManager.add(fTogglePresentation);
// }
}
-
/*
* @see IEditorActionBarContributor#setActiveEditor(IEditorPart)
*/
public void setActiveEditor(IEditorPart part) {
super.setActiveEditor(part);
-
IActionBars bars = getActionBars();
IStatusLineManager manager = bars.getStatusLineManager();
manager.setMessage(null);
manager.setErrorMessage(null);
-
ITextEditor textEditor = null;
if (part instanceof ITextEditor)
textEditor = (ITextEditor) part;
-
fContentAssist.setAction(getAction(textEditor, "ContentAssistProposal")); //$NON-NLS-1$
fContentAssistTip.setAction(getAction(textEditor, "ContentAssistTip")); //$NON-NLS-1$
- fGotoMatchingBracket.setAction(getAction(textEditor, GotoMatchingBracketAction.GOTO_MATCHING_BRACKET));
-
- bars.setGlobalActionHandler(PHPdtActionConstants.SHIFT_RIGHT, getAction(textEditor, "ShiftRight")); //$NON-NLS-1$
- bars.setGlobalActionHandler(PHPdtActionConstants.SHIFT_LEFT, getAction(textEditor, "ShiftLeft")); //$NON-NLS-1$
+ fGotoMatchingBracket.setAction(getAction(textEditor,
+ GotoMatchingBracketAction.GOTO_MATCHING_BRACKET));
+ bars.setGlobalActionHandler(PHPdtActionConstants.SHIFT_RIGHT, getAction(
+ textEditor, "ShiftRight")); //$NON-NLS-1$
+ bars.setGlobalActionHandler(PHPdtActionConstants.SHIFT_LEFT, getAction(
+ textEditor, "ShiftLeft")); //$NON-NLS-1$
// character encoding
fEncodingActionGroup.retarget(textEditor);
-
- bars.setGlobalActionHandler(PHPdtActionConstants.COMMENT, getAction(textEditor, "Comment"));
- bars.setGlobalActionHandler(PHPdtActionConstants.UNCOMMENT, getAction(textEditor, "Uncomment"));
- bars.setGlobalActionHandler(PHPdtActionConstants.FORMAT, getAction(textEditor, "Format"));
-
+ bars.setGlobalActionHandler(PHPdtActionConstants.COMMENT, getAction(
+ textEditor, "Comment"));
+ bars.setGlobalActionHandler(PHPdtActionConstants.UNCOMMENT, getAction(
+ textEditor, "Uncomment"));
+ bars.setGlobalActionHandler(PHPdtActionConstants.FORMAT, getAction(
+ textEditor, "Format"));
if (part instanceof PHPEditor) {
PHPEditor phpEditor = (PHPEditor) part;
phpEditor.getActionGroup().fillActionBars(getActionBars());
// }
// fTogglePresentation.setEditor(editor);
// fTogglePresentation.update();
-
if (textEditor != null) {
-
IFile file = null;
IEditorInput editorInput = textEditor.getEditorInput();
-
if (editorInput instanceof IFileEditorInput) {
file = ((IFileEditorInput) editorInput).getFile();
}
-
PHPeclipsePlugin.getDefault().setLastEditorFile(file);
fParserAction.setEditor(textEditor);
fParserAction.update();
- if (SWT.getPlatform().equals("win32") && textEditor instanceof AbstractTextEditor) {
+ if (textEditor instanceof AbstractTextEditor) {
fShowExternalPreviewAction.setEditor(textEditor);
fShowExternalPreviewAction.update();
- IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore();
- if (store.getBoolean(PHPeclipsePlugin.SHOW_EXTERNAL_PREVIEW_PREF)) {
- IAction a = ShowExternalPreviewAction.getInstance();
- if (a != null)
- a.run();
- }
+ IAction a = ShowExternalPreviewAction.getInstance();
+ if (a != null)
+ a.run();
}
}
}
-
/*
* @see IEditorActionBarContributor#dispose()
*/
while (e.hasNext())
getPage().removePartListener((RetargetAction) e.next());
fPartListeners.clear();
-
setActiveEditor(null);
super.dispose();
}
/** Preference key for print margin ruler column */
protected final static String PRINT_MARGIN_COLUMN = PreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN;
/** Preference key for error indication */
- protected final static String ERROR_INDICATION = PreferenceConstants.EDITOR_PROBLEM_INDICATION;
+// protected final static String ERROR_INDICATION = PreferenceConstants.EDITOR_PROBLEM_INDICATION;
/** Preference key for error color */
- protected final static String ERROR_INDICATION_COLOR = PreferenceConstants.EDITOR_PROBLEM_INDICATION_COLOR;
+// protected final static String ERROR_INDICATION_COLOR = PreferenceConstants.EDITOR_PROBLEM_INDICATION_COLOR;
/** Preference key for warning indication */
- protected final static String WARNING_INDICATION = PreferenceConstants.EDITOR_WARNING_INDICATION;
+// protected final static String WARNING_INDICATION = PreferenceConstants.EDITOR_WARNING_INDICATION;
/** Preference key for warning color */
- protected final static String WARNING_INDICATION_COLOR = PreferenceConstants.EDITOR_WARNING_INDICATION_COLOR;
+// protected final static String WARNING_INDICATION_COLOR = PreferenceConstants.EDITOR_WARNING_INDICATION_COLOR;
/** Preference key for task indication */
protected final static String TASK_INDICATION = PreferenceConstants.EDITOR_TASK_INDICATION;
/** Preference key for task color */
/** Preference key for inserting spaces rather than tabs */
private final static String SPACES_FOR_TABS = PreferenceConstants.EDITOR_SPACES_FOR_TABS;
/** Preference key for error indication */
- private final static String ERROR_INDICATION = PreferenceConstants.EDITOR_PROBLEM_INDICATION;
+// private final static String ERROR_INDICATION = PreferenceConstants.EDITOR_PROBLEM_INDICATION;
/** Preference key for error color */
- private final static String ERROR_INDICATION_COLOR = PreferenceConstants.EDITOR_PROBLEM_INDICATION_COLOR;
+// private final static String ERROR_INDICATION_COLOR = PreferenceConstants.EDITOR_PROBLEM_INDICATION_COLOR;
/** Preference key for warning indication */
- private final static String WARNING_INDICATION = PreferenceConstants.EDITOR_WARNING_INDICATION;
+// private final static String WARNING_INDICATION = PreferenceConstants.EDITOR_WARNING_INDICATION;
/** Preference key for warning color */
- private final static String WARNING_INDICATION_COLOR = PreferenceConstants.EDITOR_WARNING_INDICATION_COLOR;
+// private final static String WARNING_INDICATION_COLOR = PreferenceConstants.EDITOR_WARNING_INDICATION_COLOR;
/** Preference key for task indication */
private final static String TASK_INDICATION = PreferenceConstants.EDITOR_TASK_INDICATION;
/** Preference key for task color */
* Contributors: IBM Corporation - Initial implementation Klaus Hartlage -
* www.eclipseproject.de
******************************************************************************/
+import net.sourceforge.phpeclipse.IPreferenceConstants;
import net.sourceforge.phpeclipse.PHPeclipsePlugin;
import net.sourceforge.phpeclipse.actions.PHPEclipseShowAction;
import net.sourceforge.phpeclipse.views.browser.BrowserView;
-
import org.eclipse.core.resources.IFile;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.ui.texteditor.TextEditorAction;
+import net.sourceforge.phpeclipse.overlaypages.Util;
//import org.eclipse.update.internal.ui.UpdatePerspective;
//import org.eclipse.update.internal.ui.views.IEmbeddedWebBrowser;
/**
*/
public class ShowExternalPreviewAction extends TextEditorAction {
private static ShowExternalPreviewAction instance = new ShowExternalPreviewAction();
- protected IFile fileToParse;
/**
* Constructs and updates the action.
*/
* Code called when the action is fired.
*/
public void run() {
- fileToParse = getFile();
+ IFile fileToParse = getFile();
if (fileToParse == null) {
// should never happen
return;
}
- String localhostURL;
- if ((localhostURL = PHPEclipseShowAction.getLocalhostURL(null, fileToParse)) == null) {
- return;
- }
- IWorkbenchPage page = PHPeclipsePlugin.getActivePage();
- try {
- IViewPart part = page.findView(BrowserView.ID_BROWSER);
- if (part == null) {
- part = page.showView(BrowserView.ID_BROWSER);
- } else {
- page.bringToTop(part);
+ boolean autoPreview = Util.getPreviewBooleanValue(fileToParse,
+ IPreferenceConstants.PHP_AUTO_PREVIEW_DEFAULT);
+ boolean bringToTopPreview = Util.getPreviewBooleanValue(fileToParse,
+ IPreferenceConstants.PHP_BRING_TO_TOP_PREVIEW_DEFAULT);
+ if (autoPreview) {
+ String localhostURL;
+ if ((localhostURL = PHPEclipseShowAction.getLocalhostURL(null,
+ fileToParse)) == null) {
+ return;
+ }
+ IWorkbenchPage page = PHPeclipsePlugin.getActivePage();
+ try {
+ IViewPart part = page.findView(BrowserView.ID_BROWSER);
+ if (part == null) {
+ part = page.showView(BrowserView.ID_BROWSER);
+ } else {
+ if (bringToTopPreview) {
+ page.bringToTop(part);
+ }
+ }
+ ((BrowserView) part).setUrl(localhostURL);
+ } catch (PartInitException e) {
+ PHPeclipsePlugin.log(e);
}
- ((BrowserView) part).setUrl(localhostURL);
- } catch (PartInitException e) {
- PHPeclipsePlugin.log(e);
}
}
/**
/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
- Klaus Hartlage - www.eclipseproject.de
-**********************************************************************/
+ Copyright (c) 2000, 2002 IBM Corp. and others.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Common Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/cpl-v10.html
+
+ Contributors:
+ IBM Corporation - Initial implementation
+ Klaus Hartlage - www.eclipseproject.de
+ **********************************************************************/
package net.sourceforge.phpeclipse.phpeditor.php;
-
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.SortedMap;
-
import net.sourceforge.phpdt.core.ToolFactory;
import net.sourceforge.phpdt.core.compiler.ITerminalSymbols;
import net.sourceforge.phpdt.core.compiler.InvalidInputException;
import net.sourceforge.phpdt.internal.corext.template.ContextTypeRegistry;
import net.sourceforge.phpdt.internal.corext.template.php.CompilationUnitContextType;
import net.sourceforge.phpdt.internal.corext.template.php.PHPUnitContext;
+import net.sourceforge.phpdt.internal.ui.PHPUiImages;
import net.sourceforge.phpdt.internal.ui.text.java.IPHPCompletionProposal;
import net.sourceforge.phpdt.internal.ui.text.java.PHPCompletionProposalComparator;
import net.sourceforge.phpdt.internal.ui.text.template.BuiltInEngine;
import net.sourceforge.phpdt.internal.ui.text.template.DeclarationEngine;
import net.sourceforge.phpdt.internal.ui.text.template.IdentifierEngine;
+import net.sourceforge.phpdt.internal.ui.text.template.IdentifierProposal;
import net.sourceforge.phpdt.internal.ui.text.template.TemplateEngine;
+import net.sourceforge.phpeclipse.IPreferenceConstants;
import net.sourceforge.phpeclipse.PHPeclipsePlugin;
import net.sourceforge.phpeclipse.builder.IdentifierIndexManager;
-import net.sourceforge.phpeclipse.phpeditor.JavaOutlinePage;
-import net.sourceforge.phpeclipse.phpeditor.PHPContentOutlinePage;
import net.sourceforge.phpeclipse.phpeditor.PHPEditor;
import net.sourceforge.phpeclipse.phpeditor.PHPSyntaxRdr;
-
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.TextPresentation;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IFileEditorInput;
-
+import net.sourceforge.phpeclipse.overlaypages.Util;
+import com.quantum.model.Bookmark;
+import com.quantum.model.BookmarkCollection;
+import com.quantum.model.NotConnectedException;
+import com.quantum.util.connection.ConnectionUtil;
/**
* Example PHP completion processor.
*/
public class PHPCompletionProcessor implements IContentAssistProcessor {
-
/**
- * Simple content assist tip closer. The tip is valid in a range
- * of 5 characters around its popup location.
+ * Simple content assist tip closer. The tip is valid in a range of 5
+ * characters around its popup location.
*/
- protected static class Validator implements IContextInformationValidator, IContextInformationPresenter {
-
+ protected static class Validator
+ implements
+ IContextInformationValidator,
+ IContextInformationPresenter {
protected int fInstallOffset;
-
/*
* @see IContextInformationValidator#isContextInformationValid(int)
*/
public boolean isContextInformationValid(int offset) {
return Math.abs(fInstallOffset - offset) < 5;
}
-
/*
- * @see IContextInformationValidator#install(IContextInformation, ITextViewer, int)
+ * @see IContextInformationValidator#install(IContextInformation,
+ * ITextViewer, int)
*/
public void install(IContextInformation info, ITextViewer viewer, int offset) {
fInstallOffset = offset;
}
-
/*
- * @see org.eclipse.jface.text.contentassist.IContextInformationPresenter#updatePresentation(int, TextPresentation)
+ * @see org.eclipse.jface.text.contentassist.IContextInformationPresenter#updatePresentation(int,
+ * TextPresentation)
*/
- public boolean updatePresentation(int documentPosition, TextPresentation presentation) {
+ public boolean updatePresentation(int documentPosition,
+ TextPresentation presentation) {
return false;
}
};
-
- private static class ContextInformationWrapper implements IContextInformation, IContextInformationExtension {
-
+ private static class ContextInformationWrapper
+ implements
+ IContextInformation,
+ IContextInformationExtension {
private final IContextInformation fContextInformation;
private int fPosition;
-
public ContextInformationWrapper(IContextInformation contextInformation) {
fContextInformation = contextInformation;
}
-
/*
* @see IContextInformation#getContextDisplayString()
*/
public String getContextDisplayString() {
return fContextInformation.getContextDisplayString();
}
-
/*
- * @see IContextInformation#getImage()
- */
+ * @see IContextInformation#getImage()
+ */
public Image getImage() {
return fContextInformation.getImage();
}
-
/*
* @see IContextInformation#getInformationDisplayString()
*/
public String getInformationDisplayString() {
return fContextInformation.getInformationDisplayString();
}
-
/*
* @see IContextInformationExtension#getContextInformationPosition()
*/
public int getContextInformationPosition() {
return fPosition;
}
-
public void setContextInformationPosition(int position) {
fPosition = position;
}
};
-
private char[] fProposalAutoActivationSet;
protected IContextInformationValidator fValidator = new Validator();
private TemplateEngine fTemplateEngine;
private PHPCompletionProposalComparator fComparator;
private int fNumberOfComputedResults = 0;
-
public PHPCompletionProcessor() {
-
- ContextType contextType = ContextTypeRegistry.getInstance().getContextType("php"); //$NON-NLS-1$
+ ContextType contextType = ContextTypeRegistry.getInstance().getContextType(
+ "php"); //$NON-NLS-1$
if (contextType != null)
fTemplateEngine = new TemplateEngine(contextType);
-
fComparator = new PHPCompletionProposalComparator();
}
-
/**
* Tells this processor to order the proposals alphabetically.
*
- * @param order <code>true</code> if proposals should be ordered.
+ * @param order
+ * <code>true</code> if proposals should be ordered.
*/
public void orderProposalsAlphabetically(boolean order) {
fComparator.setOrderAlphabetically(order);
}
-
/**
* Sets this processor's set of characters triggering the activation of the
* completion proposal computation.
*
- * @param activationSet the activation set
+ * @param activationSet
+ * the activation set
*/
public void setCompletionProposalAutoActivationCharacters(char[] activationSet) {
fProposalAutoActivationSet = activationSet;
}
-
- /* (non-Javadoc)
- * Method declared on IContentAssistProcessor
+ /*
+ * (non-Javadoc) Method declared on IContentAssistProcessor
*/
- public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int documentOffset) {
- int contextInformationPosition = guessContextInformationPosition(viewer, documentOffset);
- return internalComputeCompletionProposals(viewer, documentOffset, contextInformationPosition);
+ public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer,
+ int documentOffset) {
+ int contextInformationPosition = guessContextInformationPosition(viewer,
+ documentOffset);
+ return internalComputeCompletionProposals(viewer, documentOffset,
+ contextInformationPosition);
}
-
- private int getLastToken(ITextViewer viewer, int completionPosition, PHPUnitContext context) {
+ private int getLastToken(ITextViewer viewer, int completionPosition,
+ PHPUnitContext context) {
IDocument document = viewer.getDocument();
int start = context.getStart();
int end = context.getEnd();
-
String startText;
int lastSignificantToken = ITerminalSymbols.TokenNameEOF;
-
try {
// begin search 2 lines behind of this
int j = start;
if (j != start) {
// scan the line for the dereferencing operator '->'
startText = document.get(j, start - j);
- // System.out.println(startText);
+ if (Scanner.DEBUG) {
+ System.out.println(startText);
+ }
+ int token = ITerminalSymbols.TokenNameEOF;
+
+ token = getLastSQLToken(startText);
+
Scanner scanner = ToolFactory.createScanner(false, false, false);
scanner.setSource(startText.toCharArray());
scanner.setPHPMode(true);
- int token = ITerminalSymbols.TokenNameEOF;
+
int beforeLastToken = ITerminalSymbols.TokenNameEOF;
int lastToken = ITerminalSymbols.TokenNameEOF;
-
try {
token = scanner.getNextToken();
lastToken = token;
- while (token != ITerminalSymbols.TokenNameERROR && token != ITerminalSymbols.TokenNameEOF) {
+ while (token != ITerminalSymbols.TokenNameERROR
+ && token != ITerminalSymbols.TokenNameEOF) {
beforeLastToken = lastToken;
lastToken = token;
// System.out.println(scanner.toStringAction(lastToken));
}
return lastSignificantToken;
}
-
- private ICompletionProposal[] internalComputeCompletionProposals(ITextViewer viewer, int offset, int contextOffset) {
+
+ /**
+ * Detect the last significant SQL token in the text before the completion
+ *
+ * @param startText
+ */
+ private int getLastSQLToken(String startText) {
+ int token;
+ // scan for sql identifiers
+ char ch = ' ';
+ int currentSQLPosition = startText.length();
+ int identEnd = -1;
+ String ident = null;
+ boolean whiteSpace = true;
+ try {
+ while (true) {
+ ch = startText.charAt(--currentSQLPosition);
+ if (ch >= 'A' && ch <= 'Z') {
+ if (identEnd < 0) {
+ identEnd = currentSQLPosition + 1;
+ }
+ } else if (ch >= 'a' && ch <= 'z') {
+ if (identEnd < 0) {
+ identEnd = currentSQLPosition + 1;
+ }
+ } else if (identEnd >= 0) {
+ ident = startText.substring(currentSQLPosition + 1, identEnd);
+ // select -- from -- where --
+ // update -- set -- where --
+ // insert into -- ( -- ) values ( -- )
+ if (ident.length() >= 3 && ident.length() <= 6) {
+ ident = ident.toLowerCase();
+ switch (ident.length()) {
+ case 3 :
+ if (ident.equals("set")) {
+// System.out.println("set");
+ token = ITerminalSymbols.TokenNameSQLset;
+ return token;
+ }
+ break;
+ case 4 :
+ if (ident.equals("from")) {
+// System.out.println("from");
+ token = ITerminalSymbols.TokenNameSQLfrom;
+ return token;
+ } else if (ident.equals("into")) {
+// System.out.println("into");
+ token = ITerminalSymbols.TokenNameSQLinto;
+ return token;
+ }
+ break;
+ case 5 :
+ if (ident.equals("where")) {
+// System.out.println("where");
+ token = ITerminalSymbols.TokenNameSQLwhere;
+ return token;
+ }
+ break;
+ case 6 :
+ if (ident.equals("select")) {
+// System.out.println("select");
+ token = ITerminalSymbols.TokenNameSQLselect;
+ return token;
+ } else if (ident.equals("insert")) {
+// System.out.println("insert");
+ token = ITerminalSymbols.TokenNameSQLinsert;
+ return token;
+ } else if (ident.equals("update")) {
+// System.out.println("update");
+ token = ITerminalSymbols.TokenNameSQLupdate;
+ return token;
+ } else if (ident.equals("values")) {
+// System.out.println("values");
+ token = ITerminalSymbols.TokenNameSQLvalues;
+ return token;
+ }
+ break;
+ }
+ }
+ whiteSpace = false;
+ identEnd = -1;
+ } else if (Character.isWhitespace(ch)) {
+ } else {
+ whiteSpace = false;
+ }
+ }
+ } catch (IndexOutOfBoundsException e) {
+ }
+ return ITerminalSymbols.TokenNameEOF;
+ }
+
+ private ICompletionProposal[] internalComputeCompletionProposals(
+ ITextViewer viewer, int offset, int contextOffset) {
IDocument document = viewer.getDocument();
Object[] identifiers = null;
IFile file = null;
IProject project = null;
if (offset > 0) {
-
PHPEditor editor = null;
-// JavaOutlinePage outlinePage = null;
-
- IEditorPart targetEditor = PHPeclipsePlugin.getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ // JavaOutlinePage outlinePage = null;
+ IEditorPart targetEditor = PHPeclipsePlugin.getActiveWorkbenchWindow()
+ .getActivePage().getActiveEditor();
if (targetEditor != null && (targetEditor instanceof PHPEditor)) {
editor = (PHPEditor) targetEditor;
file = ((IFileEditorInput) editor.getEditorInput()).getFile();
project = file.getProject();
-// outlinePage = editor.getfOutlinePage();
+ // outlinePage = editor.getfOutlinePage();
// TODO: get the identifiers from the new model
-// if (outlinePage instanceof PHPContentOutlinePage) {
-// identifiers = ((PHPContentOutlinePage) outlinePage).getVariables();
-// }
+ // if (outlinePage instanceof PHPContentOutlinePage) {
+ // identifiers = ((PHPContentOutlinePage) outlinePage).getVariables();
+ // }
}
}
-
- ContextType phpContextType = ContextTypeRegistry.getInstance().getContextType("php"); //$NON-NLS-1$
- ((CompilationUnitContextType) phpContextType).setContextParameters(document, offset, 0);
-
+ ContextType phpContextType = ContextTypeRegistry.getInstance()
+ .getContextType("php"); //$NON-NLS-1$
+ ((CompilationUnitContextType) phpContextType).setContextParameters(
+ document, offset, 0);
PHPUnitContext context = (PHPUnitContext) phpContextType.createContext();
String prefix = context.getKey();
-
int lastSignificantToken = getLastToken(viewer, offset, context);
- boolean useClassMembers =
- (lastSignificantToken == ITerminalSymbols.TokenNameMINUS_GREATER) ||
- (lastSignificantToken == ITerminalSymbols.TokenNameVariable) ||
- (lastSignificantToken == ITerminalSymbols.TokenNamenew);
+ boolean useClassMembers = (lastSignificantToken == ITerminalSymbols.TokenNameMINUS_GREATER)
+ || (lastSignificantToken == ITerminalSymbols.TokenNameVariable)
+ || (lastSignificantToken == ITerminalSymbols.TokenNamenew);
boolean emptyPrefix = prefix == null || prefix.equals("");
-
if (fTemplateEngine != null) {
IPHPCompletionProposal[] templateResults = new IPHPCompletionProposal[0];
-
ICompletionProposal[] results;
if (!emptyPrefix) {
fTemplateEngine.reset();
fTemplateEngine.complete(viewer, offset); //, unit);
templateResults = fTemplateEngine.getResults();
}
-
IPHPCompletionProposal[] identifierResults = new IPHPCompletionProposal[0];
if ((!useClassMembers) && identifiers != null) {
IdentifierEngine identifierEngine;
-
- ContextType contextType = ContextTypeRegistry.getInstance().getContextType("php"); //$NON-NLS-1$
+ ContextType contextType = ContextTypeRegistry.getInstance()
+ .getContextType("php"); //$NON-NLS-1$
if (contextType != null) {
identifierEngine = new IdentifierEngine(contextType);
identifierEngine.complete(viewer, offset, identifiers);
identifierResults = identifierEngine.getResults();
}
}
-
// declarations stored in file project.index on project level
IPHPCompletionProposal[] declarationResults = new IPHPCompletionProposal[0];
if (project != null) {
DeclarationEngine declarationEngine;
-
- ContextType contextType = ContextTypeRegistry.getInstance().getContextType("php"); //$NON-NLS-1$
+ ContextType contextType = ContextTypeRegistry.getInstance()
+ .getContextType("php"); //$NON-NLS-1$
if (contextType != null) {
- IdentifierIndexManager indexManager = PHPeclipsePlugin.getDefault().getIndexManager(project);
+ IdentifierIndexManager indexManager = PHPeclipsePlugin.getDefault()
+ .getIndexManager(project);
SortedMap sortedMap = indexManager.getIdentifierMap();
-
- declarationEngine = new DeclarationEngine(contextType, lastSignificantToken, file);
+ declarationEngine = new DeclarationEngine(contextType,
+ lastSignificantToken, file);
declarationEngine.complete(viewer, offset, sortedMap);
declarationResults = declarationEngine.getResults();
}
}
-
// built in function names from phpsyntax.xml
ArrayList syntaxbuffer = PHPSyntaxRdr.getSyntaxData();
IPHPCompletionProposal[] builtinResults = new IPHPCompletionProposal[0];
if ((!useClassMembers) && syntaxbuffer != null) {
BuiltInEngine builtinEngine;
String proposal;
-
- ContextType contextType = ContextTypeRegistry.getInstance().getContextType("php"); //$NON-NLS-1$
+ ContextType contextType = ContextTypeRegistry.getInstance()
+ .getContextType("php"); //$NON-NLS-1$
if (contextType != null) {
builtinEngine = new BuiltInEngine(contextType);
builtinEngine.complete(viewer, offset, syntaxbuffer);
builtinResults = builtinEngine.getResults();
}
}
-
+ IPHPCompletionProposal[] sqlResults = new IPHPCompletionProposal[0];
+ if (project != null) {
+ // Get The Database bookmark from the Quantum SQL plugin:
+ BookmarkCollection sqlBookMarks = BookmarkCollection.getInstance();
+ if (sqlBookMarks != null) {
+ String bookmarkString = Util.getMiscProjectsPreferenceValue(project,
+ IPreferenceConstants.PHP_BOOKMARK_DEFAULT);
+ if (bookmarkString != null && !bookmarkString.equals("")) {
+ Bookmark bookmark = sqlBookMarks.find(bookmarkString);
+ ArrayList list = new ArrayList();
+ if (bookmark != null && !bookmark.isConnected()) {
+ new ConnectionUtil().connect(bookmark, null);
+ }
+ if (bookmark != null && bookmark.isConnected()) {
+ try {
+ Connection connection = bookmark.getConnection();
+ DatabaseMetaData metaData = connection.getMetaData();
+ if (metaData != null) {
+ int start = context.getStart();
+ int end = context.getEnd();
+ IRegion region = new Region(start, end - start);
+ ResultSet set = metaData.getTables(null, null, prefix + "%",
+ null);
+ while (set.next()) {
+ // String tempSchema = set.getString("TABLE_SCHEM");
+ // tempSchema = (tempSchema == null) ? "" :
+ // tempSchema.trim();
+ String tableName = set.getString("TABLE_NAME");
+ tableName = (tableName == null) ? "" : tableName.trim();
+ if (tableName != null && tableName.length() > 0) {
+ list.add(tableName);
+ }
+ }
+ set.close();
+ set = metaData.getColumns(null, null, "%", prefix + "%");
+ while (set.next()) {
+ String tableName = set.getString("COLUMN_NAME");
+ tableName = (tableName == null) ? "" : tableName.trim();
+ if (tableName != null && tableName.length() > 0) {
+ list.add(tableName);
+ }
+ tableName = set.getString("TABLE_NAME");
+ tableName = (tableName == null) ? "" : tableName.trim();
+ if (tableName != null && tableName.length() > 0) {
+ list.add(tableName);
+ }
+ }
+ set.close();
+ sqlResults = new IPHPCompletionProposal[list.size()];
+ for (int i = 0; i < list.size(); i++) {
+ sqlResults[i] = new IdentifierProposal(
+ (String) list.get(i), context, region, viewer,
+ PHPUiImages.get(PHPUiImages.IMG_FUN), PHPUiImages
+ .get(PHPUiImages.IMG_VAR));
+ }
+ }
+ } catch (NotConnectedException e) {
+ // ignore this - not mission critical
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ }
// concatenate the result arrays
IPHPCompletionProposal[] total;
- total =
- new IPHPCompletionProposal[templateResults.length
- + identifierResults.length
- + builtinResults.length
- + declarationResults.length];
+ total = new IPHPCompletionProposal[templateResults.length
+ + identifierResults.length + builtinResults.length
+ + declarationResults.length + sqlResults.length];
System.arraycopy(templateResults, 0, total, 0, templateResults.length);
- System.arraycopy(identifierResults, 0, total, templateResults.length, identifierResults.length);
- System.arraycopy(builtinResults, 0, total, templateResults.length + identifierResults.length, builtinResults.length);
- System.arraycopy(
- declarationResults,
- 0,
- total,
- templateResults.length + identifierResults.length + builtinResults.length,
- declarationResults.length);
-
+ System.arraycopy(identifierResults, 0, total, templateResults.length,
+ identifierResults.length);
+ System.arraycopy(builtinResults, 0, total, templateResults.length
+ + identifierResults.length, builtinResults.length);
+ System.arraycopy(declarationResults, 0, total, templateResults.length
+ + identifierResults.length + builtinResults.length,
+ declarationResults.length);
+ System.arraycopy(sqlResults, 0, total, templateResults.length
+ + identifierResults.length + builtinResults.length
+ + declarationResults.length, sqlResults.length);
results = total;
-
fNumberOfComputedResults = (results == null ? 0 : results.length);
/*
* Order here and not in result collector to make sure that the order
- * applies to all proposals and not just those of the compilation unit.
+ * applies to all proposals and not just those of the compilation unit.
*/
return order(results);
}
return new IPHPCompletionProposal[0];
}
-
private int guessContextInformationPosition(ITextViewer viewer, int offset) {
int contextPosition = offset;
-
IDocument document = viewer.getDocument();
-
// try {
//
// PHPCodeReader reader= new PHPCodeReader();
//
// int nestingLevel= 0;
//
- // int curr= reader.read();
+ // int curr= reader.read();
// while (curr != PHPCodeReader.EOF) {
//
// if (')' == (char) curr)
// int start= reader.getOffset();
// if (looksLikeMethod(reader))
// return start + 1;
- // }
+ // }
// }
//
- // curr= reader.read();
+ // curr= reader.read();
// }
// } catch (IOException e) {
// }
-
return contextPosition;
}
-
- /* (non-Javadoc)
- * Method declared on IContentAssistProcessor
+ /*
+ * (non-Javadoc) Method declared on IContentAssistProcessor
*/
- // public IContextInformation[] computeContextInformation(ITextViewer viewer, int documentOffset) {
+ // public IContextInformation[] computeContextInformation(ITextViewer viewer,
+ // int documentOffset) {
// IContextInformation[] result = new IContextInformation[5];
// for (int i = 0; i < result.length; i++)
- // result[i] = new ContextInformation(MessageFormat.format(PHPEditorMessages.getString("CompletionProcessor.ContextInfo.display.pattern"), new Object[] { new Integer(i), new Integer(documentOffset)}), //$NON-NLS-1$
- // MessageFormat.format(PHPEditorMessages.getString("CompletionProcessor.ContextInfo.value.pattern"), new Object[] { new Integer(i), new Integer(documentOffset - 5), new Integer(documentOffset + 5)})); //$NON-NLS-1$
+ // result[i] = new
+ // ContextInformation(MessageFormat.format(PHPEditorMessages.getString("CompletionProcessor.ContextInfo.display.pattern"),
+ // new Object[] { new Integer(i), new Integer(documentOffset)}),
+ // //$NON-NLS-1$
+ // MessageFormat.format(PHPEditorMessages.getString("CompletionProcessor.ContextInfo.value.pattern"),
+ // new Object[] { new Integer(i), new Integer(documentOffset - 5), new
+ // Integer(documentOffset + 5)})); //$NON-NLS-1$
// return result;
// }
/**
* @see IContentAssistProcessor#computeContextInformation(ITextViewer, int)
*/
- public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) {
- int contextInformationPosition = guessContextInformationPosition(viewer, offset);
+ public IContextInformation[] computeContextInformation(ITextViewer viewer,
+ int offset) {
+ int contextInformationPosition = guessContextInformationPosition(viewer,
+ offset);
List result = addContextInformations(viewer, contextInformationPosition);
- return (IContextInformation[]) result.toArray(new IContextInformation[result.size()]);
+ return (IContextInformation[]) result
+ .toArray(new IContextInformation[result.size()]);
}
-
private List addContextInformations(ITextViewer viewer, int offset) {
- ICompletionProposal[] proposals = internalComputeCompletionProposals(viewer, offset, -1);
-
+ ICompletionProposal[] proposals = internalComputeCompletionProposals(
+ viewer, offset, -1);
List result = new ArrayList();
for (int i = 0; i < proposals.length; i++) {
- IContextInformation contextInformation = proposals[i].getContextInformation();
+ IContextInformation contextInformation = proposals[i]
+ .getContextInformation();
if (contextInformation != null) {
- ContextInformationWrapper wrapper = new ContextInformationWrapper(contextInformation);
+ ContextInformationWrapper wrapper = new ContextInformationWrapper(
+ contextInformation);
wrapper.setContextInformationPosition(offset);
result.add(wrapper);
}
}
return result;
}
-
/**
* Order the given proposals.
*/
Arrays.sort(proposals, fComparator);
return proposals;
}
-
- /* (non-Javadoc)
- * Method declared on IContentAssistProcessor
+ /*
+ * (non-Javadoc) Method declared on IContentAssistProcessor
*/
public char[] getCompletionProposalAutoActivationCharacters() {
return fProposalAutoActivationSet;
// return null; // new char[] { '$' };
}
-
- /* (non-Javadoc)
- * Method declared on IContentAssistProcessor
+ /*
+ * (non-Javadoc) Method declared on IContentAssistProcessor
*/
public char[] getContextInformationAutoActivationCharacters() {
- return new char[] {
- };
+ return new char[]{};
}
-
- /* (non-Javadoc)
- * Method declared on IContentAssistProcessor
+ /*
+ * (non-Javadoc) Method declared on IContentAssistProcessor
*/
public IContextInformationValidator getContextInformationValidator() {
return fValidator;
}
-
- /* (non-Javadoc)
- * Method declared on IContentAssistProcessor
+ /*
+ * (non-Javadoc) Method declared on IContentAssistProcessor
*/
public String getErrorMessage() {
return null;
--- /dev/null
+package net.sourceforge.phpeclipse.preferences;
+
+import org.eclipse.core.runtime.QualifiedName;
+
+/**
+ * constnats for project preferences
+ */
+public interface IMiscProjectPreferences {
+
+ /**
+ * namespace URI for the properties
+ */
+// public static final String PROPERTY_NAMESPACE = "http://phpeclipse.org";
+
+ // public static final String PREF_ID = "net.sourceforge.phpeclipse.preferences.PHPMiscProjectPreferences";
+// /**
+// * property local name for the publish directory
+// */
+// public static final String PUBLISH_PROPERTY = "publish";
+//
+// /**
+// * property qualified name for the publish directory
+// */
+// public static final QualifiedName PUBLISH_PROPERTY_NAME =
+// new QualifiedName(PROPERTY_NAMESPACE,PUBLISH_PROPERTY);
+//
+// /**
+// * default value for the publish directory name
+// */
+// public static final String DEFAULT_PUBLISH_DIR = "c:\\temp";
+
+
+}
\ No newline at end of file
+++ /dev/null
-package net.sourceforge.phpeclipse.preferences;
-
-import org.eclipse.core.runtime.QualifiedName;
-
-/**
- * constnats for project preferences
- */
-public interface IObfuscatorPreferences {
-
- /**
- * namespace URI for the properties
- */
- public static final String PROPERTY_NAMESPACE = "http://phpeclipse.org";
-
- /**
- * property local name for the publish directory
- */
- public static final String PUBLISH_PROPERTY = "publish";
-
- /**
- * property qualified name for the publish directory
- */
- public static final QualifiedName PUBLISH_PROPERTY_NAME =
- new QualifiedName(PROPERTY_NAMESPACE,PUBLISH_PROPERTY);
-
- /**
- * default value for the publish directory name
- */
- public static final String DEFAULT_PUBLISH_DIR = "c:\\temp";
-
-
-}
\ No newline at end of file
--- /dev/null
+package net.sourceforge.phpeclipse.preferences;
+import net.sourceforge.phpeclipse.IPreferenceConstants;
+import net.sourceforge.phpeclipse.PHPeclipsePlugin;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.StringFieldEditor;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+import net.sourceforge.phpeclipse.overlaypages.FieldEditorOverlayPage;
+/**
+ *
+ * This page will be added to the project's property page dialog when the
+ * "Properties..." popup menu item is selected
+ */
+public class PHPMiscProjectPreferences extends FieldEditorOverlayPage
+ implements
+ IWorkbenchPreferencePage,
+ IMiscProjectPreferences {
+
+ public final static String PREF_ID = "net.sourceforge.phpeclipse.preferences.PHPMiscProjectPreferences";
+ public PHPMiscProjectPreferences() {
+ super(GRID);
+ }
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.bdaum.overlayPages.FieldEditorOverlayPage#getPageId()
+ */
+ protected String getPageId() {
+ return PREF_ID;
+ }
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
+ */
+ protected void createFieldEditors() {
+ Composite composite = getFieldEditorParent();
+ addField(new StringFieldEditor(IPreferenceConstants.PHP_BOOKMARK_DEFAULT,
+ PHPPreferencesMessages.getString("PHPMiscProjectPreferences.bookmark"),
+ composite));
+
+ //if (!isPropertyPage)) {
+ //
+ //}
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.PreferencePage#doGetPreferenceStore()
+ */
+ protected IPreferenceStore doGetPreferenceStore() {
+ return PHPeclipsePlugin.getDefault().getPreferenceStore();
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ */
+ public void init(IWorkbench workbench) {
+ setDescription("Default entries for misc project settings.");
+ }
+}
\ No newline at end of file
+++ /dev/null
-package net.sourceforge.phpeclipse.preferences;
-
-import net.sourceforge.phpeclipse.PHPeclipsePlugin;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.layout.RowLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.PropertyPage;
-
-/**
- *
- * This page will be added to the project's property page dialog when the "Properties..." popup menu item is selected
- */
-public class PHPObfuscatorPropertyPage extends PropertyPage implements IObfuscatorPreferences {
- private Text publishText;
- // private DirectoryFieldEditor dfe;
- private Group group;
- private ProjectProperties properties;
-
- private Control buildUI(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- RowLayout rowLayout = new RowLayout();
- rowLayout.type = SWT.VERTICAL;
- rowLayout.wrap = false;
- composite.setLayout(rowLayout);
- // hasNature = new Button(composite,SWT.CHECK);
- // hasNature.setText(PHPPreferencesMessages.getString("PHPObfuscatorPropertyPage.hasnature"));
- // hasNature.addSelectionListener(new SelectionListener()
- // {
- // public void widgetDefaultSelected(SelectionEvent e)
- // {
- // group.setEnabled(hasNature.getSelection());
- // }
- //
- // public void widgetSelected(SelectionEvent e)
- // {
- // group.setEnabled(hasNature.getSelection());
- // }
- // });
- group = new Group(composite, SWT.NONE);
- group.setText(PHPPreferencesMessages.getString("PHPObfuscatorPropertyPage.properties"));
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 2;
- group.setLayout(gridLayout);
-
- Label label = new Label(group, SWT.RIGHT);
- label.setText(PHPPreferencesMessages.getString("PHPObfuscatorPropertyPage.publish"));
- publishText = new Text(group, SWT.LEFT);
- publishText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
-
-// dfe =
-// new DirectoryFieldEditor(
-// "PHPObfuscatorPropertyPage.publish",
-// PHPPreferencesMessages.getString("PHPObfuscatorPropertyPage.publish"),
-// group);
-
- return composite;
- }
-
- public void readProperties() throws CoreException {
- publishText.setText(properties.getPublish());
- // dfe.loadDefault();
- // hasNature.setSelection(properties.hasNature());
- // group.setEnabled(hasNature.getSelection());
- group.setEnabled(true);
- }
-
- public void writeProperties() throws CoreException {
- // properties.setNature(hasNature.getSelection());
- properties.setPublish(publishText.getText());
- // dfe.store();
- }
-
- public Control createContents(Composite parent) {
- Control control = buildUI(parent);
- try {
- IAdaptable adaptable = getElement();
- if (adaptable instanceof IProject) {
- properties = new ProjectProperties((IProject) adaptable);
- readProperties();
- }
- } catch (CoreException x) {
- ErrorDialog.openError(
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- PHPPreferencesMessages.getString("PHPObfuscatorPropertyPage.dialogtitle"),
- PHPPreferencesMessages.getString("PHPObfuscatorPropertyPage.propertyerror"),
- makeStatus(x));
- }
- return control;
- }
-
- public boolean performOk() {
- try {
- writeProperties();
- } catch (CoreException x) {
- ErrorDialog.openError(
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- PHPPreferencesMessages.getString("PHPObfuscatorPropertyPage.dialogtitle"),
- PHPPreferencesMessages.getString("PHPObfuscatorPropertyPage.propertyerror"),
- makeStatus(x));
- }
- return super.performOk();
- }
-
- public void performApply() {
- try {
- writeProperties();
- } catch (CoreException x) {
- ErrorDialog.openError(
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- PHPPreferencesMessages.getString("PHPObfuscatorPropertyPage.dialogtitle"),
- PHPPreferencesMessages.getString("PHPObfuscatorPropertyPage.propertyerror"),
- makeStatus(x));
- }
- super.performApply();
- }
- /**
- * Create an IStatus object from an exception.
- * @param x exception to process
- * @return IStatus status object for the above exception
- */
- public static IStatus makeStatus(Exception x) {
- // Throwable t = popThrowables(x);
- // if(t instanceof CoreException)
- // return ((CoreException)t).getStatus();
- // else
- return new Status(IStatus.ERROR, PHPeclipsePlugin.PLUGIN_ID, IStatus.ERROR, x.getMessage(), x);
- }
- public void performDefaults() {
- // hasNature.setSelection(true);
- publishText.setText(DEFAULT_PUBLISH_DIR);
- super.performDefaults();
- }
-}
\ No newline at end of file
PHPProjectPropertyPage.performOkExceptionDialogTitle=Unable to save
PHPProjectPropertyPage.performOkExceptionDialogMessage=ERROR: Unable to save project properties.
-PHPObfuscatorPropertyPage.hasnature=Is PHP project.
-PHPObfuscatorPropertyPage.publish=Obfuscator directory:
-PHPObfuscatorPropertyPage.dialogtitle=PHP
-PHPObfuscatorPropertyPage.projecterror=Could not create the new project.
-PHPObfuscatorPropertyPage.properties=PHP Obfuscator Project Properties
+PHPMiscProjectPreferences.bookmark=SQL default bookmark:
+PHPMiscProjectPreferences.obfuscator=Obfuscator directory:
+
+PHPPreviewProjectPreferences.auto_preview=Refresh PHP browser view when opening editor
+PHPPreviewProjectPreferences.bring_to_top_preview=Show PHP browser view when opening editor
#########################################
# Preference Pages
PHPBasePreferencePage.websettingsGroup.docroot=DocumentRoot
PHPBasePreferencePage.websettingsGroup.browser=External browser command
PHPBasePreferencePage.websettingsGroup.useexternal=Use external browser
-PHPBasePreferencePage.websettingsGroup.showexternalpreview=Show preview on editor load (win32 only)
+#PHPBasePreferencePage.websettingsGroup.showexternalpreview=Show preview on editor load (win32 only)
PHPBasePreferencePage.apacheGroup=Apache Settings
PHPBasePreferencePage.apacheGroup.run=Apache
PHPBasePreferencePage.apacheGroup.start=Start Apache
--- /dev/null
+package net.sourceforge.phpeclipse.preferences;
+import net.sourceforge.phpeclipse.IPreferenceConstants;
+import net.sourceforge.phpeclipse.PHPeclipsePlugin;
+
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+import net.sourceforge.phpeclipse.overlaypages.FieldEditorOverlayPage;
+/**
+ *
+ * This page will be added to the project's property page dialog when the
+ * "Properties..." popup menu item is selected
+ */
+public class PHPPreviewProjectPreferences extends FieldEditorOverlayPage
+ implements
+ IWorkbenchPreferencePage {
+ public final static String PREF_ID = "net.sourceforge.phpeclipse.preferences.PHPPreviewProjectPreferences";
+
+ public PHPPreviewProjectPreferences() {
+ super(GRID, true);
+ }
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.bdaum.overlayPages.FieldEditorOverlayPage#getPageId()
+ */
+ protected String getPageId() {
+ return PREF_ID;
+ }
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
+ */
+ protected void createFieldEditors() {
+ Composite composite = getFieldEditorParent();
+ addField(new BooleanFieldEditor(
+ IPreferenceConstants.PHP_AUTO_PREVIEW_DEFAULT, PHPPreferencesMessages
+ .getString("PHPPreviewProjectPreferences.auto_preview"), composite));
+ addField(new BooleanFieldEditor(
+ IPreferenceConstants.PHP_BRING_TO_TOP_PREVIEW_DEFAULT, PHPPreferencesMessages
+ .getString("PHPPreviewProjectPreferences.bring_to_top_preview"), composite));
+ //if (!isPropertyPage)) {
+ //
+ //}
+ }
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.preference.PreferencePage#doGetPreferenceStore()
+ */
+ protected IPreferenceStore doGetPreferenceStore() {
+ return PHPeclipsePlugin.getDefault().getPreferenceStore();
+ }
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ */
+ public void init(IWorkbench workbench) {
+ setDescription("Default entries for Previewer.");
+ }
+}
\ No newline at end of file
+++ /dev/null
-package net.sourceforge.phpeclipse.preferences;
-
-import net.sourceforge.phpeclipse.PHPeclipsePlugin;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.QualifiedName;
-
-
-public class ProjectProperties
- implements IObfuscatorPreferences
-{
- private IProject project;
-
- // private static final String DEFAULT_BUILD = String.valueOf(DEFAULT_BUILD_VALUE);
-
- public ProjectProperties(IProject project)
- {
- this.project = project;
- }
-
-
- public String getPublish()
- throws CoreException
- {
- return getProperty(PUBLISH_PROPERTY_NAME,DEFAULT_PUBLISH_DIR);
- }
-
- public boolean hasNature()
- throws CoreException
- {
- return project.hasNature(PHPeclipsePlugin.PHP_NATURE_ID);
- }
-
- public void setPublish(String publish)
- throws CoreException
- {
- setProperty(PUBLISH_PROPERTY_NAME,publish,DEFAULT_PUBLISH_DIR);
- }
-
-
- public void setNature(boolean nature)
- throws CoreException
- {
- if(nature)
- {
- if(!hasNature())
- {
- IProjectDescription description = project.getDescription();
- String[] old = description.getNatureIds(),
- natures= new String[old.length + 1];
- System.arraycopy(old,0,natures,0,old.length);
- natures[old.length] = PHPeclipsePlugin.PHP_NATURE_ID;
- description.setNatureIds(natures);
- project.setDescription(description,new NullProgressMonitor());
- }
- }
- else
- {
- if(hasNature())
- {
- IProjectDescription description = project.getDescription();
- String[] old = description.getNatureIds(),
- natures= new String[old.length - 1];
- int i = 0,
- j = 0;
- while(i < old.length)
- {
- if(!old[i].equals(PHPeclipsePlugin.PHP_NATURE_ID))
- natures[j++] = old[i];
- i++;
- }
- description.setNatureIds(natures);
- project.setDescription(description,new NullProgressMonitor());
- }
- }
- }
-
- protected String getProperty(QualifiedName key,String def)
- throws CoreException
- {
- String value = project.getPersistentProperty(key);
- if(value == null || value.length() == 0)
- return def;
- else
- return value;
- }
-
- protected void setProperty(QualifiedName key,String value,String def)
- throws CoreException
- {
- if(value != null && value.length() != 0 && hasNature())
- {
- if(value.equals(def))
- project.setPersistentProperty(key,null);
- else
- project.setPersistentProperty(key,value);
- }
- }
-}
\ No newline at end of file